Page 1 of 1

Sorting on Data Retrieval

Posted: Wed Jul 24, 2013 2:21 pm
by cbarnhart
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

Re: Sorting on Data Retrieval

Posted: Fri Aug 23, 2013 12:33 pm
by BvG
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.

Re: Sorting on Data Retrieval

Posted: Tue Oct 29, 2013 11:07 pm
by phaworth
Putting single quotes around Date makes SQL think it's a literal value not a column name.
Pete