有点难度的问题 这个查询怎么办呢? Select t1.a ,sum(t2.b) as b from t1,t2 where t2.id=t1.idgroup by t1.a 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a,(select sum(b) from t2 where id=t1.id) b from t1 select a,(select sum(b) from t2 where id=t1.id) b from t1就这个了 select a,b from t1,t2 select a,b from t1,t2 where t2.id=t1.id ___________________________________________________________________________谢谢大家但是t2.b 是 varchar 类型哦___________________________________________________________________________ 汇总下:select a,(select sum(b) from t2 where id=t1.id) b from t1或Select t1.a ,sum(t2.b) as b from t1,t2 where t2.id=t1.idgroup by t1.a呵呵!楼主结贴吧! t2.b 是 varchar 类型哦 是字符型, cast 不了哦。 sql2005数据库恢复问题,高手帮忙看下.谢谢了.没分了,大家见谅 errno 150急等!先谢谢了 去掉同一表中的重复记录 将查询结果存入表中 执行存储过程出错 古怪的问题,求助! 新人求教存储过程。。 SQL Audit Log可以把trace文件转成txt文件吗? sql2000 bug??? 有关变量赋值问题 能实现这样的功能?!!! 找出某节点下所有子节点的存储过程 分组的一个问题
就这个了
谢谢大家
但是
t2.b 是 varchar 类型哦___________________________________________________________________________
select a,(select sum(b) from t2 where id=t1.id) b from t1或Select t1.a ,sum(t2.b) as b from t1,t2 where t2.id=t1.id
group by t1.a呵呵!
楼主结贴吧!
t2.b 是 varchar 类型哦