| 49 | select * |
| 50 | FROM |
| 51 | ( |
| 52 | select lokacija, |
| 53 | coalesce(sum (date_part('hour',krajno_vreme-pocetno_vreme)),'0')*75 as vreme_januari |
| 54 | from ime_na_parking as inp |
| 55 | left join zona as z on ime_na_parking_id_ime =id_ime |
| 56 | left join parking_mesto as pm on id_zona= idzona |
| 57 | left join rezervacija as rez on rez.broj_na_pmesta=pm.broj_na_pmesta |
| 58 | where extract(month from pocetno_vreme)=1 and extract(year from pocetno_vreme)=extract(year from now()) |
| 59 | group by inp.lokacija |
| 60 | order by vreme_januari desc |
| 61 | ) as inp |
| 62 | left join |
| 63 | ( |
| 64 | select lokacija, |
| 65 | coalesce(sum (date_part('hour',krajno_vreme-pocetno_vreme)),'0')*75 as vreme_februari |
| 66 | from ime_na_parking as inp |
| 67 | left join zona as z on ime_na_parking_id_ime =id_ime |
| 68 | left join parking_mesto as pm on id_zona= idzona |
| 69 | left join rezervacija as rez on rez.broj_na_pmesta=pm.broj_na_pmesta |
| 70 | where extract(month from pocetno_vreme)=2 |
| 71 | group by inp.lokacija |
| 72 | order by vreme_februari desc |
| 73 | ) as inpp |
| 74 | ON |
| 75 | inp.lokacija = inpp.lokacija |
| 76 | left join ( |
| 77 | select lokacija, |
| 78 | coalesce(sum (date_part('hour',krajno_vreme-pocetno_vreme)),'0')*75 as vreme_mart |
| 79 | from ime_na_parking as inp |
| 80 | left join zona as z on ime_na_parking_id_ime =id_ime |
| 81 | left join parking_mesto as pm on id_zona= idzona |
| 82 | left join rezervacija as rez on rez.broj_na_pmesta=pm.broj_na_pmesta |
| 83 | where extract(month from pocetno_vreme)=3 |
| 84 | group by inp.lokacija |
| 85 | order by vreme_mart desc |
| 86 | ) as inppp |
| 87 | ON |
| 88 | inpp.lokacija = inppp.lokacija |
| 89 | left join ( |
| 90 | select lokacija, |
| 91 | coalesce(sum (date_part('hour',krajno_vreme-pocetno_vreme)),'0')*75 as vreme_april |
| 92 | from ime_na_parking as inp |
| 93 | left join zona as z on ime_na_parking_id_ime =id_ime |
| 94 | left join parking_mesto as pm on id_zona= idzona |
| 95 | left join rezervacija as rez on rez.broj_na_pmesta=pm.broj_na_pmesta |
| 96 | where extract(month from pocetno_vreme)=4 |
| 97 | group by inp.lokacija |
| 98 | order by vreme_april desc |
| 99 | ) as inp1 |
| 100 | ON |
| 101 | inp1.lokacija = inppp.lokacija |
| 102 | left join ( |
| 103 | select lokacija, |
| 104 | coalesce(sum (date_part('hour',krajno_vreme-pocetno_vreme)),'0')*75 as vreme_maj |
| 105 | from ime_na_parking as inp |
| 106 | left join zona as z on ime_na_parking_id_ime =id_ime |
| 107 | left join parking_mesto as pm on id_zona= idzona |
| 108 | left join rezervacija as rez on rez.broj_na_pmesta=pm.broj_na_pmesta |
| 109 | where extract(month from pocetno_vreme)=5 |
| 110 | group by inp.lokacija |
| 111 | order by vreme_maj desc |
| 112 | ) as inp2 |
| 113 | ON |
| 114 | inp1.lokacija = inp2.lokacija |
| 115 | left join ( |
| 116 | select lokacija, |
| 117 | coalesce(sum (date_part('hour',krajno_vreme-pocetno_vreme)),'0')*75 as vreme_juni |
| 118 | from ime_na_parking as inp |
| 119 | left join zona as z on ime_na_parking_id_ime =id_ime |
| 120 | left join parking_mesto as pm on id_zona= idzona |
| 121 | left join rezervacija as rez on rez.broj_na_pmesta=pm.broj_na_pmesta |
| 122 | where extract(month from pocetno_vreme)=6 |
| 123 | group by inp.lokacija |
| 124 | order by vreme_juni desc |
| 125 | ) as inp3 |
| 126 | ON |
| 127 | inp2.lokacija = inp3.lokacija |
| 128 | |