wiki:AdvancedReports

Version 3 (modified by 181213, 2 years ago) ( diff )

--

Напредни извештаи од базата (SQL и складирани процедури)

  • Ресторан со најмногу нарачки за последниот Х период?
    SELECT q1.restoran_ime 
    FROM(
    SELECT r.restoran_ime, COUNT(n.naracka_id) as naracki
    FROM restoran as r
    JOIN meni as m on r.restoran_id=m.restoran_id 
    JOIN obrok as o on m.meni_id=o.meni_id 
    JOIN se_sostoi_od as sso on o.obrok_id=sso.obrok_id 
    JOIN naracka as n on sso.naracka_id=n.naracka_id 
    GROUP BY r.restoran_ime) q1
    WHERE q1.naracki=(SELECT MAX(naracki)FROM (
    SELECT r.restoran_ime, COUNT(n.naracka_id) as naracki
    FROM restoran as r
    JOIN meni as m on r.restoran_id=m.restoran_id 
    JOIN obrok as o on m.meni_id=o.meni_id 
    JOIN se_sostoi_od as sso on o.obrok_id=sso.obrok_id 
    JOIN naracka as n on sso.naracka_id=n.naracka_id 
    GROUP BY r.restoran_ime) q1
    )
    
  • Најголем профит?
  • Најнарачан производ по ресторан?

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.