So I’m tasked with discovering the client within the database with essentially the most positioned orders by worth. I used to be eager about tackling this drawback one thing alongside the strains like this:
choose ime,priimek, rely(stranka_idstranka), sum(cena) as vrednost_racunov from racun rc, stranka s, cenik the place s.idstranka = rc.stranka_idstranka group by idstranka having vrednost_racunov = (choose max(cena) from (choose sum(cena) from cenik internal be a part of zdravilo_cenik on cenik.idcenik = zdravilo_cenik.cenik_idcenik internal be a part of zdravilo on zdravilo.idzdravilo = zdravilo_cenik.idzdravilo_cenik internal be a part of racun_zdravilo on racun_zdravilo.id_racun_zdravilo = zdravilo.idzdravilo internal be a part of racun on racun.idracun = racun_zdravilo.racun_idracun the place datum_izdaje = "2020-03-02" and izdan_racun = 0;) temp) order by vrednost_racunov;
however I didnt get what I wished. To make clear some translation points
Cenik = Value listing
Recept = Prescription
Račun = Receipt and the attribute izdan_racun tiny int means if the medication bought was a prescription then the izdan_racun = Zero which suggests no receipt was given.