July 23, 2016 at 10:41 pm
Comments posted to this topic are about the item The basic Aggregate function
Thanks,
Shiva N
Database Consultant
July 24, 2016 at 2:17 pm
Nice straightforward question.
This is one of those things (like the handling of SUM) the makes me think that someone had a screw loose when they were specifying how aggregates worked in unusual circumetances.
Tom
July 24, 2016 at 10:52 pm
This was removed by the editor as SPAM
July 25, 2016 at 8:57 am
I think this kind of makes sense if you come at it from the Oracle perspective. In Oracle, to select values you have to go against the SYS.DUAL table, a table with a single dummy record. For example, the equivalent of SELECT GETDATE(); in Oracle would be SELECT sysdate FROM dual;. So the equivalent of SELECT COUNT(1); in Oracle would be SELECT COUNT(1) FROM dual;, which would return 1.
Be still, and know that I am God - Psalm 46:10
July 25, 2016 at 11:32 am
Thanks, great question. The behavior is not at all what I expected, but it is good to know.
- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
July 25, 2016 at 12:32 pm
david.gugg (7/25/2016)
I think this kind of makes sense if you come at it from the Oracle perspective. In Oracle, to select values you have to go against the SYS.DUAL table, a table with a single dummy record. For example, the equivalent of SELECT GETDATE(); in Oracle would be SELECT sysdate FROM dual;. So the equivalent of SELECT COUNT(1); in Oracle would be SELECT COUNT(1) FROM dual;, which would return 1.
So what happens in Oracle if you just execute SELECT GETDATE(); ?
July 26, 2016 at 6:31 am
david.gugg (7/25/2016)
I think this kind of makes sense if you come at it from the Oracle perspective. In Oracle, to select values you have to go against the SYS.DUAL table, a table with a single dummy record. For example, the equivalent of SELECT GETDATE(); in Oracle would be SELECT sysdate FROM dual;. So the equivalent of SELECT COUNT(1); in Oracle would be SELECT COUNT(1) FROM dual;, which would return 1.
Didn't know that about Oracle.
July 27, 2016 at 6:36 am
Easy one, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply