uid, gid, status
|1 4 2|
|1 2 1|
|1 7 2|
Zeby pobrać liczbę ile uid =1 ma status równy 2 wpisuje
SELECT Count(status) as raz FROM tabela WHERE uid=1 and status =2
//żeby sprawdzić status równy 1
SELECT Count(status) as raz FROM tabela WHERE uid=1 and status =1
Czy da się te zapytania połączyć w jedno? Tak żeby wynikiem były dwa pola (status1,status2)
Próbowałem coś takiego
SELECT Count(STATUS) AS status1, status2, (SELECT Count(STATUS) AS status2 FROM xp WHERE uid=1 AND STATUS=2) FROM xp WHERE uid =1 AND STATUS=1
Ale nie działa