Count Aggregate:
Just declare a table, say
DECLARE @t table
(
id int identity(1,1),
value varchar(50)
)
Insert some values,
INSERT INTO @t values(NULL)
INSERT INTO @t values(NULL)
INSERT INTO @t values(NULL)
INSERT INTO @t values('1')
INSERT INTO @t values('2')
INSERT INTO @t values('3')
What is the output?
SELECT count(id), count(value) FROM @t
It's 6,3 actually because, The Count aggregate does not include NULL values, so the count will be 3 rows for the 2nd column
No comments:
Post a Comment