求一SQL语句,数据查询,只剩30分了(30)

  • 主题发起人 主题发起人 灵成
  • 开始时间 开始时间

灵成

Unregistered / Unconfirmed
GUEST, unregistred user!
表id userid total1 8 32 8 43 8 34 6 25 6 16 7 87 8 9怎样查询才能统计显示userid total2 8 19 6 3 7 8access下
 
SELECT userid, SUM(total) AS total2FROM 表GROUP BY userid
 
这个问题太简单了!兄弟要多看看书!SELECT userid, SUM(total) AS total2FROM 表GROUP BY userid
 
SELECT userid, SUM(total) AS total2FROM 表GROUP BY useridORDER BY userid desc
 
('select userid,sum(total) from 表名 group by userid');
 
select userID, sum(total) as total from 表 group by user_id order by min(ID)
 
select userid,sum(total) as total2 from 表名order by userid desc
 
拖出去打!!
 
我的答案和楼上各位一样
 
用group by就可以,建议楼主多问问身边同事或是查查SQL帮助,很实用的
 
晕,都只问但不结贴。打消积极性啊
 
selectuserid, sum(total) as total2from tablenamegroup by useridorder by userid desc
 
同意楼上的。我的答案也一样。还是要多看看书。这个问题太简单了。
 
select UserID, Sum(total) as Total from TableName group by user_id order by min(ID)
 
要多学习多思考
 
后退
顶部