group by 分组问题。 select id,bid,cid from group by id,bid,cid,did ordey by did desc为什么分group by 分组的时候 只要在SQL中出现的列 group后面都要写上?为什么。我只想按id分组。。应该只取出1条。如果我加上bid。cid就会取出50条。如何解决 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select *from tb twhere id=(select min(id) from tb where bid=t.bid and cid=t.cid) select * from tb t where not exists(select 1 from tb where id=t.id and bid>t.bid or (bid=t.bid and cid>t.cid)) 晕,分组肯定啦,要全部分select id,MAX(bid),MAX(cid),MAX(DID) from group by id ORDER by MAX(DID) desc select 中的列只能比group 中的列多一列,且这一列要用聚合函数 你想一想吧,A-B--C1-2--21-3--3你要统计B按A分组,统计后是1--5要是你来个C,C怎么办,他不知道C最后是哪个了吧 sqlserver 数据导入问题 关于一动态交叉表SQL? 关于XP加域的求教 sqlserver2005 设置填充因子 Oracle中to_date(ny,'yyyymm')在SQLServer如何实现 有关字符串相加的问题,类似SUM,求高手(已回答的问题,找 zjcxc(邹建)) 怎么做统计报表?求救... 初学SQLserver2000,问一下注册服务器失败是什么原理 关于异构数据库的问题,急,在线等待…… sql问题 远程登陆到ORACLE提示表不存在 SQL同一字段中有多个值去除重复的值
*
from
tb t
where
id=(select min(id) from tb where bid=t.bid and cid=t.cid)
where not exists(select 1 from tb where id=t.id and bid>t.bid or (bid=t.bid and cid>t.cid))
select id,MAX(bid),MAX(cid),MAX(DID) from group by id ORDER by MAX(DID) desc
A-B--C
1-2--2
1-3--3
你要统计B按A分组,统计后是1--5要是你来个C,C怎么办,他不知道C最后是哪个了吧