打中国的日本天皇是谁:select distinct id ,num=sum(cast((num) as int) from sy order by id desc

来源:百度文库 编辑:高校问答 时间:2024/05/15 05:46:37
有什么地方错了,指出谢谢!

应该分组查询
select distinct id ,Totalnum=count(num)
from sy group by id order by id desc

如果num不是int可以
select distinct id ,nums=count(cast((num) as int)
from sy group by id order by id desc

sum(cast((num) as int)
int 是保留字。换个名字试试