Posted on:

15 Nov 2022


I would use fetch funtion

Thank you Tina! Though I think this is tricky answers, a bit tedious with so many CTE. I would use fetch function.
     with joined (date, consumption)
      as( select * from asian_energy union all  select * from eu_enegy)
select date,  sum(consumption) as Totalconsumption
from joined
group by date
order by Totalconsumption desc offset 0 rows fetch next 1 rows only

0 answers ( 0 marked as helpful)

Submit an answer