I have to get dates in my date column in 4 quarters Q1,Q1,Q3,Q4 using mysql query.
These are basically quarter.
for example year month is:
2012 May -march - 2012Q1
2012 April-June - 2012Q2
2011 July- SEP - 2011Q3
2010 OCT - Dec - 2010Q4
I am doing it with different if else conditions and getting confused. It there any simple way to do this ? Or it will be better to make a stored procedure for it?
Seems you want to get quarter from given date. It’s simple to get and no need for stored procedure.
You can use mysql function
QUARTER()to get quater of given date.like :