Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT eventi.*,COUNT(prenotazioni.id) AS n_prenotazioni,
- CASE n_posti <= n_prenotazioni WHEN TRUE THEN 0 ELSE 1 END AS ok_posti
- FROM eventi.eventi
- LEFT JOIN
- eventi.prenotazioni ON eventi.id=prenotazioni.evento_id
- GROUP BY eventi.id
Add Comment
Please, Sign In to add comment