| 58 | |
| 59 | == Прикажување на најчитаната книга на еден автор за одреден временски период |
| 60 | {{{#!sql |
| 61 | select * from pozajmica; |
| 62 | select k.naslov, a.ime, count(p.id_na_pozajmica) as pozajmuvanja from |
| 63 | pozajmica as p |
| 64 | |
| 65 | join knigi as k on p.id_na_kniga=k.id_na_kniga |
| 66 | join izdava as i on k.id_na_kniga = i.id_knigi |
| 67 | join avtor as a on i.id_avtor = a.id_na_avtor |
| 68 | where a.ime like '%Goce%' and p.datum_na_zemanje between now() - interval'1 month' and now() |
| 69 | |
| 70 | group by 1,2 |
| 71 | order by pozajmuvanja desc |
| 72 | fetch first row only; |
| 73 | }}} |