searchsanjaysharma
asked on
I have the following table, how to make it in ascending order with All option.
I have a table mstquarters where this kind of data is there with fields quarter and level
quarter level
Sep - Dec 2010 - P1 1
Jan - Mar 2011 - P2 2
Apr - Jun 2011 - P3 3
Jul - Sep 2011 - P4 4
Oct - Dec 2011 - P5 5
Jan - Mar 2012 - P6 6
Apr - Jun 2012 - P7 7
Jul - Sep 2012 - P8 8
I want the output should come as
All
Sep - Dec 2010 - P1
Jan - Mar 2011 - P2
Apr - Jun 2011 - P3
Jul - Sep 2011 - P4
Oct - Dec 2011 - P5
Jan - Mar 2012 - P6
Apr - Jun 2012 - P7
Jul - Sep 2012 - P8
i.e ALL, P1, P2, P3... etc
This query is not working
select quarter from(select 'All Quarters' as quarter from mstquarters union select distinct quarter from mstquarters)x order by 1
quarter level
Sep - Dec 2010 - P1 1
Jan - Mar 2011 - P2 2
Apr - Jun 2011 - P3 3
Jul - Sep 2011 - P4 4
Oct - Dec 2011 - P5 5
Jan - Mar 2012 - P6 6
Apr - Jun 2012 - P7 7
Jul - Sep 2012 - P8 8
I want the output should come as
All
Sep - Dec 2010 - P1
Jan - Mar 2011 - P2
Apr - Jun 2011 - P3
Jul - Sep 2011 - P4
Oct - Dec 2011 - P5
Jan - Mar 2012 - P6
Apr - Jun 2012 - P7
Jul - Sep 2012 - P8
i.e ALL, P1, P2, P3... etc
This query is not working
select quarter from(select 'All Quarters' as quarter from mstquarters union select distinct quarter from mstquarters)x order by 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER