46 | | - Најнарачан производ по ресторан сортиран? |
| 46 | - Најнарачан производ по ресторан сортиран |
| 47 | {{{#!sql |
| 48 | select q1.restoran_ime as restoran, MAX(q1.obrok_ime) as obrok, MAX(q1.br_obroci) as broj_naracki FROM( |
| 49 | SELECT r.restoran_ime, o.obrok_ime, SUM(sso.kolicina) as br_obroci |
| 50 | FROM restoran as r |
| 51 | JOIN meni as m on r.restoran_id=m.restoran_id |
| 52 | JOIN obrok as o on m.meni_id=o.meni_id |
| 53 | JOIN se_sostoi_od as sso on o.obrok_id=sso.obrok_id |
| 54 | JOIN naracka as n on sso.naracka_id=n.naracka_id |
| 55 | GROUP BY r.restoran_ime, o.obrok_ime)q1 |
| 56 | group by restoran |
| 57 | order by broj_naracki desc |
| 58 | }}} |