i want to create a table having years as rows and 3 columns where the values would be the number of projects for each year where the revenue is below 500k, between 500k and 1M, greater than 1M. i was told to try the Case statment but i really can't get it done. i m using mysql
my fields are fiscalYear and AdjRevenue1YCommited from financials_tbl.
i started aiming to get just 3 columns (year,below500,between 500 and 1M)
select fiscalYear,
Case
When AdjRevenue1YCommited < 500000 then count(AdjRevenue1YCommited)
Else null
end as b500,
Case
When AdjRevenue1YCommited between 500000 and 1000000 then count(AdjRevenue1YCommited)
Else null
end as a500
from financials_tbl
group by fiscalYear