141 | | select p.ime as predmet, n.ime as nastavnik, count(u.id_ucenik) as br_ucenici |
142 | | from predmeti p |
143 | | join predava_predmet pp on p.id_predmet = pp.id_predmet |
144 | | join nastavnici n on pp.id_nastavnik = n.id_nastavnik |
145 | | join predava_na pn on n.id_nastavnik = pn.id_nastavnik |
146 | | join ucenici u on u.id_ucenik =pn.id_ucenik |
147 | | where p.id_predmet = 1 |
148 | | group by p.ime, n.ime |
149 | | order by br_ucenici desc |
| 141 | select u."name", u.surname, count(e.id_event) as broj_nastani |
| 142 | from artist a join users u on a.id_user =u.id_user |
| 143 | join events e on a.id_user =e.id_user_artist |
| 144 | where u.id_user in ( |
| 145 | select u.id_user |
| 146 | from artist a join users u on a.id_user =u.id_user |
| 147 | join events e on a.id_user =e.id_user_artist |
| 148 | where e.id_event =1 |
| 149 | group by u.id_user ) |
| 150 | group by u."name", u.surname |