select c,count(b) from table_name group by c
c,及每个C对应的元素数量
select * from table_name order by c,a asc这个样子吗?
至于查询性能,你做一个索引就OK了
select date,sum(case when sco = '胜' then 1 else 0 end) as '胜(数量)'
,sum(case when sco = '负' then 1 else 0 end) as '负(数量)'
FROM score
group by date
试着运行下这个程序
SELECT t.id, t.pro, t.createdate, (SELECT cost FROM t_cost x WHERE x.upd_date = (SELECT max(x2.upd_date) FROM t_cost x2 WHERE t.createdate >= x2.upd_dateand x2.pro = t.pro) and x.pro = t.pro) FROM t_order t欢迎分享,转载请注明来源:内存溢出
评论列表(0条)