Posted by 泽鹏, Jan. 14, 2024, 7:19 p.m.

Question for 14. Good days and bad days

select sum(case when val>100 then 1 else 0 end) ,sum(case when val <=100 then 1 else 0 end)
from (
SELECT EXTRACT(Day from rental_ts               )   ,count(rental_id              ) val
FROM rental  
where EXTRACT(YEAR from rental_ts               )=2020 and EXTRACT(MONth from rental_ts               ) = 5
group by EXTRACT(Day from rental_ts               )    
) temp

why did not work?

 

Answer

Answers


Comment
SQLPad user: Abinaya Subbiah

- Abinaya (2)

Feb. 3, 2024, 11:55 a.m.