如何计算由id命令的所有星星 [英] how to count all stars ordered by id's

查看:92
本文介绍了如何计算由id命令的所有星星的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有商店的桌子评级:



TableName:房价



i have table for store the rating:

TableName: Rates

ID Rating
1  4
2  5
1  3
2  4
3  4
2  3





我想按ID计算总评分,并使用asp.net-C#



I want to count the total rating by id and store the another table using asp.net-C#

推荐答案

创建一个新表并从旧表中按ID插入这些值。

create a new table and insert those values from old table Group by ID's
insert into  Ratings1(ID, rating )SELECT ID, SUM(rating) as TotalRating FROM Rates ORDER BY IDSELECT ID, SUM(rating) as TotalRating FROM Rates Group BY ID









学习它。



< a href =http://www.w3schools.com/sql/sql_insert_into_select.asp> http://www.w3schools.com/sql/sql_insert_into_select.asp [ ^ ]





http://www.w3schools.com/sql/sql_groupby.asp [ ^ ]


这篇关于如何计算由id命令的所有星星的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆