这两句返回的结果不一样

来源:百度知道 编辑:UC知道 时间:2024/06/07 23:30:11
count(price) 多少行, count(*) 这个是什么

如:统计表有多少条记录

select count(*) from table

当指定列时,要注意事项.null是不计算的
declare @T table(ID int)
insert @T select 1
union all select null

select count(*) as '等于2',count(ID) as '等于1' from @T

等于2 等于1
----------- -----------
2 1

(1 行受影响)