value of month in sequence using sql procedure
<pre lang="SQL">SELECT DateCreated,totCount FROM( SELECT REPLACE( RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ' ', ' ') AS DateCreated, COUNT(DISTINCT tof.unique_id) AS totCount FROM trn_open_files tof JOIN trn_debtor tb ON (tof.unique_id=tb.unique_id AND tb.debtor_seq_num=1 AND tb.rec_status='R') JOIN trn_property tp ON (tof.unique_id=tp.unique_id) LEFT OUTER JOIN trn_parties prty_cccs ON (prty_cccs.unique_id=tof.unique_id AND prty_cccs.party_role='CCCS' AND prty_cccs.rec_status='A') LEFT OUTER JOIN trn_parties prty_srv ON (prty_srv.unique_id=tof.unique_id AND prty_srv.party_role='SRV' AND prty_srv.rec_status='A') LEFT OUTER JOIN trn_parties prty_vend ON (prty_vend.unique_id= tof.unique_id AND prty_vend.party_role='CLMO' AND prty_vend.rec_status='A') LEFT OUTER JOIN trn_parties prty_ins ON (prty_ins.unique_id= tof.unique_id AND prty_ins.party_role='INS' AND prty_ins.rec_status='A') LEFT OUTER JOIN trn_parties prty_ss ON (prty_ss.unique_id= tof.unique_id AND prty_ss.party_role='SS' AND prty_ss.rec_status='A') LEFT OUTER JOIN trn_parties prty_realtor ON (prty_realtor.unique_id= tof.unique_id AND prty_realtor.party_role='REALTOR' AND prty_realtor.rec_status='A') LEFT OUTER JOIN mst_comp_info mci1 ON (mci1.comp_id = prty_cccs.party_comp_id AND mci1.comp_type='CCCS' AND mci1.rec_status='A') LEFT OUTER JOIN mst_comp_info mci ON (mci.comp_id = prty_srv.party_comp_id AND mci.comp_type='SRV' AND mci.rec_status='A' AND mci.pilot_flag='Y') LEFT OUTER JOIN mst_comp_info mci2 ON (mci2.comp_id = prty_vend.party_comp_id AND mci2.comp_type='VEND' AND mci2.rec_status='A') LEFT OUTER JOIN mst_comp_info mci3 ON (mci3.comp_id = prty_ins.party_comp_id AND mci3.comp_type='INS' AND mci3.rec_status='A') LEFT OUTER JOIN mst_comp_info mci4 ON (mci4.comp_id = prty_ss.party_comp_id AND mci4.comp_type='SS' AND mci4.rec_status='A') LEFT OUTER JOIN mst_comp_info mci5 ON (mci5.comp_id = prty_realtor.party_comp_id AND mci4.comp_type='REALTOR' AND mci4.rec_status='A') LEFT OUTER JOIN mst_status_codes i ON (i.status_code=tof.case_status AND i.comp_id=tof.comp_id AND (i.party_role IS NULL OR i.party_role='VEND') AND tof.file_type=i.file_type) WHERE tof.cur_status='A' AND tof.cms_flag='Y' AND CONVERT(DATE,tof.create_stamp) &gt;= CONVERT(DATE,'2010-06-06') AND CONVERT(DATE,tof.create_stamp) &lt;= CONVERT(DATE,'2011-10-01') AND prty_cccs.party_comp_id=10153 AND prty_cccs.party_comp_id=10153 GROUP BY REPLACE( RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ' ', ' '),prty_cccs.party_comp_id) q1</pre>

having this procedure how to show month in proper sequence.

now month is appear as
<pre lang="text">
out put: DateCreated totcount Sep 11 7
May 11 2
Jun 11 10
Jul 11 40
Aug 11 144</pre>

i want month in sequence like DateCreated totcount May 11 2
<pre lang="text">Jun 11 10
Jul 11 40
Aug 11 144
Sep 11 7</pre>

value of month in sequence using sql procedure
===

<pre lang="SQL">SELECT DateCreated,totCount FROM( SELECT REPLACE( RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ' ', ' ') AS DateCreated, COUNT(DISTINCT tof.unique_id) AS totCount FROM trn_open_files tof JOIN trn_debtor tb ON (tof.unique_id=tb.unique_id AND tb.debtor_seq_num=1 AND tb.rec_status='R') JOIN trn_property tp ON (tof.unique_id=tp.unique_id) LEFT OUTER JOIN trn_parties prty_cccs ON (prty_cccs.unique_id=tof.unique_id AND prty_cccs.party_role='CCCS' AND prty_cccs.rec_status='A') LEFT OUTER JOIN trn_parties prty_srv ON (prty_srv.unique_id=tof.unique_id AND prty_srv.party_role='SRV' AND prty_srv.rec_status='A') LEFT OUTER JOIN trn_parties prty_vend ON (prty_vend.unique_id= tof.unique_id AND prty_vend.party_role='CLMO' AND prty_vend.rec_status='A') LEFT OUTER JOIN trn_parties prty_ins ON (prty_ins.unique_id= tof.unique_id AND prty_ins.party_role='INS' AND prty_ins.rec_status='A') LEFT OUTER JOIN trn_parties prty_ss ON (prty_ss.unique_id= tof.unique_id AND prty_ss.party_role='SS' AND prty_ss.rec_status='A') LEFT OUTER JOIN trn_parties prty_realtor ON (prty_realtor.unique_id= tof.unique_id AND prty_realtor.party_role='REALTOR' AND prty_realtor.rec_status='A') LEFT OUTER JOIN mst_comp_info mci1 ON (mci1.comp_id = prty_cccs.party_comp_id AND mci1.comp_type='CCCS' AND mci1.rec_status='A') LEFT OUTER JOIN mst_comp_info mci ON (mci.comp_id = prty_srv.party_comp_id AND mci.comp_type='SRV' AND mci.rec_status='A' AND mci.pilot_flag='Y') LEFT OUTER JOIN mst_comp_info mci2 ON (mci2.comp_id = prty_vend.party_comp_id AND mci2.comp_type='VEND' AND mci2.rec_status='A') LEFT OUTER JOIN mst_comp_info mci3 ON (mci3.comp_id = prty_ins.party_comp_id AND mci3.comp_type='INS' AND mci3.rec_status='A') LEFT OUTER JOIN mst_comp_info mci4 ON (mci4.comp_id = prty_ss.party_comp_id AND mci4.comp_type='SS' AND mci4.rec_status='A') LEFT OUTER JOIN mst_comp_info mci5 ON (mci5.comp_id = prty_realtor.party_comp_id AND mci4.comp_type='REALTOR' AND mci4.rec_status='A') LEFT OUTER JOIN mst_status_codes i ON (i.status_code=tof.case_status AND i.comp_id=tof.comp_id AND (i.party_role IS NULL OR i.party_role='VEND') AND tof.file_type=i.file_type) WHERE tof.cur_status='A' AND tof.cms_flag='Y' AND CONVERT(DATE,tof.create_stamp) &gt;= CONVERT(DATE,'2010-06-06') AND CONVERT(DATE,tof.create_stamp) &lt;= CONVERT(DATE,'2011-10-01') AND prty_cccs.party_comp_id=10153 AND prty_cccs.party_comp_id=10153 GROUP BY REPLACE( RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ' ', ' '),prty_cccs.party_comp_id) q1</pre>

having this procedure how to show month in proper sequence.

now month is appear as
<pre lang="text">
out put: DateCreated totcount Sep 11 7
May 11 2
Jun 11 10
Jul 11 40
Aug 11 144</pre>

i want month in sequence like DateCreated totcount May 11 2
<pre lang="text">Jun 11 10
Jul 11 40
Aug 11 144
Sep 11 7</pre>
