この問題で私を助けることができますか?これら 3 つの SELECT を結合する必要があります.........可能ですか? テーブルが 1 つ必要です... collums:jmeno、Pocet_zapasu、branek、Pocet_zapasu2、branek2、Pocet_turnaju、branek3。
/*Soutezni zapasy*/
SELECT
Jmeno,
COUNT(CASE WHEN Ucast = 'TRUE' then 1 end) as Pocet_zapasu,
SUM(CASE WHEN Branky>0 then Branky end) as branek
FROM Hraci
INNER JOIN Ucast_Zapas ON Ucast_Zapas.ID_Hrace_zapas=Hraci.IDHrace
INNER JOIN Zapas ON Zapas.ID_zapas=Ucast_Zapas.ID_zapasu_ucast
INNER JOIN Kategorie ON Kategorie.IDkategorie=Zapas.Kategorie_zapas
WHERE (Kategorie.IDkategorie = 1) AND Zapas_Datum >= '1/1/2013' AND Zapas_Datum < '9/1/2014' AND(Zapas.Druh=1)
GROUP BY Jmeno;
/*Pratelske zapasy*/
SELECT
Jmeno,
COUNT(CASE WHEN Ucast = 'TRUE' then 1 end) as Pocet_zapasu2,
SUM(CASE WHEN Branky>0 then Branky end) as branek2
FROM Hraci
INNER JOIN Ucast_Zapas ON Ucast_Zapas.ID_Hrace_zapas=Hraci.IDHrace
INNER JOIN Zapas ON Zapas.ID_zapas=Ucast_Zapas.ID_zapasu_ucast
INNER JOIN Kategorie ON Kategorie.IDkategorie=Zapas.Kategorie_zapas
WHERE (Kategorie.IDkategorie = 1) AND Zapas_Datum >= '1/1/2013' AND Zapas_Datum < '9/1/2014' AND(Zapas.Druh=2)
GROUP BY Jmeno;
/*turnaje*/
SELECT
Jmeno,
COUNT(CASE WHEN Ucast = 'TRUE' then 1 end) as Pocet_turnaju,
SUM(CASE WHEN Branky>0 then Branky end) as branek3
FROM Hraci
INNER JOIN Ucast_Turnaj ON Ucast_Turnaj.ID_Hrace_turnaj=Hraci.IDHrace
INNER JOIN Turnaj ON Turnaj.ID_turnaj=Ucast_Turnaj.ID_turnaje_ucast
INNER JOIN Kategorie ON Kategorie.IDkategorie=Turnaj.Kategorie_Turnaj
WHERE (Kategorie.IDkategorie = 1) AND Turnaj_Datum >= '1/1/2013' AND Turnaj_Datum < '9/1/2014'
GROUP BY Jmeno;