客户销售统计

conqu12 2012-05-18 08:17:19
客户消费明细:
-----------------------------------------------------
张山,笔记本电脑,5600,1
李华,U盘,78,5
李华,台式电脑,3500,1
王军,运动衣,150,2
张山,手机,1200,1
赵晋,手机电池,35,2
王超,电风扇,152,2
刘凯,鼠标,120,3
李四,电脑包,220,8
-----------------------以上信息在文本框里面-----------
现要将以上消费最多的前三个人显示在另一个文本框中(注意:上面有的人买了几样商品,要把消费总和算出来。第三个数字为价钱,第四个为数量)
...全文
107 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunylf 2012-05-18
  • 打赏
  • 举报
回复
select top 3 sum(price*num),name from xxx group by name order by sum(price*num) desc
test2050 2012-05-18
  • 打赏
  • 举报
回复
datatable中order by实现
http://www.byywee.com/page/M0/S445/445562.html
IT-Style 2012-05-18
  • 打赏
  • 举报
回复
好像是这样:

select top 3 sum(price*numcount) as total,name from xxxx group by name
test2050 2012-05-18
  • 打赏
  • 举报
回复
不然就在内存中做个表来操作对表执行sql
自己找下datatable的用法,然后对datatable执行sql
http://topic.csdn.net/t/20041108/14/3532129.html
conqu12 2012-05-18
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]
把数据放在数据库中,楼上一个sql的事。
[/Quote]

还没有学过数据库额,能不能帮我想想别的办法啊?谢谢!
test2050 2012-05-18
  • 打赏
  • 举报
回复
把数据放在数据库中,楼上一个sql的事。
conqu12 2012-05-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]
select top 3 sum(price) as total,name from xxxx group by name
[/Quote]

这是什么?不是代码吧?
lqkankan 2012-05-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

select top 3 sum(price) as total,name from xxxx group by name
[/Quote]

+1
lqkankan 2012-05-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

select top 3 sum(price) as total,name from xxxx group by name
[/Quote]

bdmh 2012-05-18
  • 打赏
  • 举报
回复
select top 3 sum(price) as total,name from xxxx group by name

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧