Guest User

Untitled

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