Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Output 1

Status
Not open for further replies.

ctromb

Programmer
Jul 23, 2003
6
US
I have a variable named eventdate, which lists schedule dates for a concert in this format (Wednesday, July 7, 2004), they are being entered in a database through a form in a random order.So ASC or DESC in query output will not work.

I need to display concert dates from most recent to furthest away in date order. How should this be handled.
 
I don't understand why using "ORDER BY eventdate" in your query wouldn't work. It shouldn't matter what order the dates were put in. Can you show us your query?



Hope This Helps!

Ecobb

"My work is a game, a very serious game." - M.C. Escher
 
<CFQUERY name="GetSchedule" datasource="#Datasource#">
SELECT * FROM schedule ORDER BY 'eventdate'
</CFQUERY>


But using above query with (order by) is producing this output

Monday, September 20, 2004
Wednesday, July 7, 2004
Sunday, April 18, 2004
Wednesday, May 12, 2004
 
why do you have single quotes around eventdate?

thereptilian120x120.gif
 
Is your eventdate column in the database a date/time datatype? If so, try putting some type of date formatting in the Order By clause of your SQL Statement. Use the formatting to order it by the actual date, not in alphabetical order by day of the week.



Hope This Helps!

Ecobb

&quot;My work is a game, a very serious game.&quot; - M.C. Escher
 
Ecobb - Thanks

Database field was set incorrectly as a text field not a date/time field, After change was made, using correct DateFormat string around my variable as well as Order By clause I was able to achieve results I was looking for, Thanks for pointing me in the right direction
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top