temtable dbtable{ {
bsid bsid
score name
} }我要做的是 一个表格中显示 name sum(score) 按分数由高到底排序我的sql语句是:
select temtable.bsid,dbtable.name,sum(temtable.score) from temtable,dbtable where temtable.bsid=dbtable.bsid group by temtable.bsid
可是计算机告诉我 据和函数 group by 不能在这个sql中通过,如果对一个表求和倒是能成功,这是两张表如何处理阿
解决后 立刻结账 拜托中!!!!!!
bsid bsid
score name
} }我要做的是 一个表格中显示 name sum(score) 按分数由高到底排序我的sql语句是:
select temtable.bsid,dbtable.name,sum(temtable.score) from temtable,dbtable where temtable.bsid=dbtable.bsid group by temtable.bsid
可是计算机告诉我 据和函数 group by 不能在这个sql中通过,如果对一个表求和倒是能成功,这是两张表如何处理阿
解决后 立刻结账 拜托中!!!!!!
解决方案 »
- 如何控制MaskEdit中输入的字符小于指定数字。
- fastreport这个脚本怎么写,急急急,在线等
- dbgrid中的时间显示(疑问)
- 如何网络版程序的客户端个数,有没有什么好的解决方案啊。
- 如何控制SPCOMM控件中的WriteCommData和OnReceiveData事件的同步问题?
- 想用TPageControl控件进行页之间的转换,可是无法控制它的颜色变化
- 有没有中专毕业(或者更低)的程序员,进来聊聊!
- 哪位朋友有关于项目验收文档的标准模板,最好有例子,196分奉献!
- 哪位C/S+scktsrvr高人救救我啊!!!!!!!!!!!!!!!!!!!!
- 怎样让程序运行后关闭自已
- 控件开发之 _ OnSave事件
- ADOQuery怎样SaveToStream
dbtable.name, 不能再同时显示了——或者,只能显示其中的一行,min/max
你把两个条件temtable.bsid,dbtable.name作为group by。
insert into t1
select '1',80
union all
select '2',63
union all
select '1',88
union all
select '3',95
go
create table t2(bsid varchar(10),[name] varchar(10))
insert into t2
select '1','xiao'
union all
select '2','shui'
union all
select '3','lin'
goselect t1.bsid,[name],sum(score) score
from t1,t2
where t1.bsid=t2.bsid
group by t1.bsid,t2.[name]
order by score desc
bsid name score
---------- ---------- -----------
1 xiao 168
3 lin 95
2 shui 63(3 row(s) affected)
是这个意思吗?