Very sorry about forgetting the code tags.
Thank you very much -- it makes all the sense in the world, I just couldn't figure out HOW to include the select code in the order.
Have a great day!
User Profile
Collapse
Profile Sidebar
Collapse
aladiver
Last Activity: May 14 '14, 06:28 PM
Joined: May 14 '14
Location:
-
Cannot use ORDER BY with DISTINCT and CONVERT
The following SQL code works fine if I don't use the CONVERT to make my column two characters wide. When using it as follows the error message reads:
"ORDER BY items must appear in the select list if SELECT DISTINCT is specified." If I just use:
SELECT DISTINCT MONTH(CTNoteDat e) it works fine.
How can I run this query with the column width set and sort the results?
...Code:SELECT DISTINCT CONVERT(varchar(2),MONTH(CTNoteDate))
Last edited by Rabbit; May 14 '14, 05:30 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
No activity results to display
Show More
Leave a comment: