I am trying to sort my data as I grab it from the database. I want to sort the data in Desending order by the field date -
put revQueryDatabase( theConnectionID, "select * from hospaccess.News where Type = 'Market' ORDER BY 'Date' DESC") into theCursor
But the Sort is not working. I am hoping I am making a simple mistake
Any suggestions
Sorting on Data Retrieval
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Sorting on Data Retrieval
You are using the database sorting, so this is not really LC specific. Maybe you stored the date field in a non-date format, so the database that you use doesn't understand that it is in fact a date. If you don't want to figure out how to sort stuff in sql, you can always sort the data afterwards in LC, using the "sort" command. But then too, you'll need to watch out to use a date format that is easily sortable (i personally like the seconds for that), so you might also need to loop trough the data and use "convert" for each line.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Sorting on Data Retrieval
Putting single quotes around Date makes SQL think it's a literal value not a column name.
Pete
Pete