关于SQL中sum()的问题
create table productinfo (
productinfo_idint identity(1000,1)not null,
entry_idvarchar(14)null,
inportimechar(5) default convert(char(5), getdate(), 108),
func11int DEFAULT 0,
func12int DEFAULT 0,
func13int DEFAULT 0,
func14int DEFAULT 0,
func15int DEFAULT 0,
sums as func11+func12+func13+func14+func15
)
输入数据后
f1 f2 f3 f4 f5 sums
1000 20070104000110:200 1 0 0 1 2
1001 20070104000210:250 0 1 0 0 1
1002 20070104000310:350 0 0 0 0 0
1003 20070104000410:400 0 0 0 0 0
1004 20070104000210:450 0 0 0 0 0
1005 20070104000110:500 0 0 0 0 0
现在要得到有多少条数据,怎么做?
[解决办法]
select count(entry_id)
from productinfo
group by entry_id