select - SQL complicated query -
i have following problem sql query. managed execute 15 of them 1 makes me sick. it's hard translate understand.
show years , months numbers , sum of costs of ‘borrowed-time’ in months monthly sum of costs lesser biggest 1 in february , march in 2006.
and have far (one of version of query because tried many of them)
select extract(month data_wyp), sum(koszt) wypozyczenia koszt<(select sum(koszt) wypozyczenia sum(koszt)<(select max(sum(koszt)) wypozyczenia extract(month data_wyp)='2' or extract(month data_wyp)='3' group extract(month data_wyp))) group extract(month data_wyp);
the problem cannot equal sum(koszt)
, tried save them using as
doesn't work either.
please me because ruined day.
thanks in advance.
to filter results of aggregate function in sql query, place comparisons in having
statement.
Comments
Post a Comment