ORDER BY statement - need help! (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


z0diac -> ORDER BY statement - need help! (6/5/2002 0:04:59)

I have 3 fields - YEAR (4 digit value from 1998 to 2002), MONTH (1 or 2 digit value from 1 to 12, DAY (1 or 2 digit value from 1 to 31).

I need to display database records from NEWEST to OLDEST. So all must be sorted by YEAR, and the years must be sorted by MONTH, and the months must be sorted by DAY. DESCending order. Can anyone tell me what the correct SQL statement would be?




Light -> RE: ORDER BY statement - need help! (6/5/2002 2:12:56)

If you're using Database Result Wizard from step 3 of 5,click on MORE OPTIONS then ORDERING, then choose from AVAILABLE FIELDS then SORT ORDER.

<%Thgil%>




bobby -> RE: ORDER BY statement - need help! (6/5/2002 10:12:17)

Have you thought of building a query into the database that does the sorting, and then call the stored procedure and sisplay the first record?
_____

"There is too much apathy in the world, but I don't care."




Malc -> RE: ORDER BY statement - need help! (6/5/2002 15:05:10)

I have not tested this with FP but if you are looking to use a select statement your code should be something like:-

SELECT Year, Month, Day
FROM TableName
GROUP BY Year,Month, Day
ORDER BY Year DESC , Month DESC , Day DESC;





z0diac -> RE: ORDER BY statement - need help! (6/6/2002 14:27:15)

Thanks everyone - it was the DESC after each field that was missing (I was using it just at the end... Year,Month,Day DESC which should have been Year DESC,Month DESC,Day DESC







Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.03125