一条SQL语句能解决吗? test表a b 222 11 444 11 456 22 774 33 910 33... .. 查询结果:222 444 11456 12774 910 33一条SQL能解决吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select b,max(if(a=222,0)),max(if(a=444,a,0))....from tt group by b 假设A唯一select b,max(if(bz=1,a,0)), max(if(bz=2,a,0)) from (select a,b,(select count(*) from tt where a.b=b and a.a<=a) as bzfrom tt a) cgroup by b select min(a),max(a),bfrom testgroup by b select group_concat(a SEPARATOR ' '),bfrom test表group by b 关于求第n大值的问题 小弟要初步学习下数据库技术,这里有个问题,请大神们给点提示 这两个的SQL的效率谁好点? mysql递归查询请教 mysql 奇怪的错误 php无法连接mysql 数据库 请教一个建表是出现的问题 关于mysql的代化.做500人的压力测试,总是当机 急救!我的表到哪儿去了! 为什么我的webapp程序经过若干段时间之后会出现communication link failure的问题。 mysql NOT IN ,!= 可以使用索引吗? mysql 同表的列复制
from tt group by b
select b,max(if(bz=1,a,0)), max(if(bz=2,a,0)) from (
select a,b,(select count(*) from tt where a.b=b and a.a<=a) as bz
from tt a) c
group by b
from test
group by b
from test表
group by b