| 4 | {{{#!sql |
| 5 | SELECT q1.restoran_ime |
| 6 | FROM( |
| 7 | SELECT r.restoran_ime, COUNT(n.naracka_id) as naracki |
| 8 | FROM restoran as r |
| 9 | JOIN meni as m on r.restoran_id=m.restoran_id |
| 10 | JOIN obrok as o on m.meni_id=o.meni_id |
| 11 | JOIN se_sostoi_od as sso on o.obrok_id=sso.obrok_id |
| 12 | JOIN naracka as n on sso.naracka_id=n.naracka_id |
| 13 | GROUP BY r.restoran_ime) q1 |
| 14 | WHERE q1.naracki=(SELECT MAX(naracki)FROM ( |
| 15 | SELECT r.restoran_ime, COUNT(n.naracka_id) as naracki |
| 16 | FROM restoran as r |
| 17 | JOIN meni as m on r.restoran_id=m.restoran_id |
| 18 | JOIN obrok as o on m.meni_id=o.meni_id |
| 19 | JOIN se_sostoi_od as sso on o.obrok_id=sso.obrok_id |
| 20 | JOIN naracka as n on sso.naracka_id=n.naracka_id |
| 21 | GROUP BY r.restoran_ime) q1 |
| 22 | ) |
| 23 | }}} |