| 150 | | select q4."location", q4.max_broj_nastani |
| 151 | | from ( |
| 152 | | ( |
| 153 | | select extract (year from t.date) as godina, |
| 154 | | count(distinct e.id_event) broj_nastani, t."location" |
| 155 | | from ticket t |
| 156 | | join events e on t.id_event = e.id_event |
| 157 | | group by godina, t."location" |
| 158 | | ) q1 |
| 159 | | |
| 160 | | join |
| 161 | | |
| 162 | | ( |
| 163 | | select max(q2.broj_nastani) as max_broj_nastani |
| 164 | | from |
| 165 | | ( |
| 166 | | select extract (year from t.date) as godina, |
| 167 | | count(distinct e.id_event) broj_nastani, |
| 168 | | t."location" |
| 169 | | from ticket t |
| 170 | | join events e on t.id_event = e.id_event |
| 171 | | group by godina, t."location" |
| 172 | | ) q2 ) q3 |
| 173 | | on |
| 174 | | q1.broj_nastani = q3.max_broj_nastani) |
| 175 | | as q4 |
| 176 | | }}} |
| 177 | | }}} |
| 178 | | |
| 179 | | OR |
| 180 | | |
| 181 | | {{{#!div style="font-size: 90%" |
| 182 | | {{{#!sql |