
mvelia
08 de Febrero del 2010
|
anexo el query..
SELECT date(case when fid is NULL then Mdate else fdate end) as Fecha
,hour(case when fid is NULL then Mdate else fdate end)as Hr
,SUM(case when is_m = 1 then 1 else 0 end) as EngClickYes
, SUM(case when is_m = 0 then 1 else 0 end) as EngClickNo
,SUM(case when fid is not NULL and Mdidm = 1 then 1 else 0 end) as MFound
,SUM(case when fid is not NULL and Mdidm = 0 then 1 else 0 end) as MNotFound
,SUM(case when fid is NULL and is_m = 1 then 1 else 0 end) as YetToBePlayed
FROM game G
LEFT JOIN done_games ON G.gameid = fid
right JOIN matches M ON M.musrid = G.gusrid and M.medusrid = G.gamemid
where date(case when fid is NULL then M.mdate else fdate end) = date
group by hour(case when fid is NULL then M.mdate else fdate end)
|