Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with sorting criteria

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello SQL Gurus,

I have a table with a field call C_TYPE which can have values within
range "E", "M", "A", "N". I also have a date field C_DATE.

I want a Select SQL which will be give me records sorted by Date and within that by C_TYPE. Now the problem is that
the sorting by C_TYPE has to be in order of E M A & N only.

Can somebody help me out with this situation.

Thanx
 
Try this SQL,

Select <Fields you want>, ToSort =
Case Field1
When &quot;E&quot; Then 1
When &quot;M&quot; Then 2
When &quot;A&quot; THen 3
When &quot;N&quot; Then 4
End
From tblYourTable Order by Date, ToSort


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top