3 08-01-07 W 4 08-01-10 W 5 08-01-12 W 6 08-01-14 W w4是指上面连续的四个W吧。。mysql存储过程里面应该有游标的,用游标来遍历
这个直接select count(*) from tbl group by win_lost 不就行了嘛
select a.dateplayed,isnull(b.res1,0) as 'W',isnull(c.res2,0) as 'L' from (select dateplayed from table2 group by dateplayed) a, (select dateplayed,count(win_lose) as 'res1' from table2 where win_lose='W' group by dateplayed) b,(select dateplayed,count(win_lose) as 'res2' from table2 where win_lose='L' group by dateplayed) c where a.dateplayed*=b.dateplayedand a.dateplayed*=c.dateplayedgroup by a.dateplayed,res1,res2
4 08-01-10 W
5 08-01-12 W
6 08-01-14 W
w4是指上面连续的四个W吧。。mysql存储过程里面应该有游标的,用游标来遍历
(select dateplayed,count(win_lose) as 'res1' from table2
where win_lose='W' group by dateplayed) b,(select dateplayed,count(win_lose) as 'res2'
from table2 where win_lose='L' group by dateplayed) c
where a.dateplayed*=b.dateplayedand a.dateplayed*=c.dateplayedgroup by a.dateplayed,res1,res2