I have an Access database I am querying with SQL from VB .NET. The Table I’m querying has a column called “Day” which has the days stored as the text data type in Access. I need to select all the unique instances in the field so am currently using:
SELECT Day FROM Slot GROUP BY Day
But this returns the days in alphabetical order when I need them in chronological order. Now assuming that the only possible values it can take are “Monday”, “Tuesday”, “Wednesday” ,”Thursday” and “Friday”, what would you recommend doing to sort them correctly?
Edit: The table is called Slot and has three columns; SlotNumber (AutoNumber), Day (Text), SlotTime (Text). An example might be:
SlotNumber: 6
Day: Monday
SlotTime: 2:40PM
If you are stuck with the data as is, I would recommend that you add an ORDER BY clause. Within the ORDER BY clause you will want to map each distinct value to a numeric value.
e.g., Using IIf
e.g., Using SWITCH