ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old March 31st, 2004, 09:37 AM
bwedekin bwedekin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Dubai, UAE
Posts: 449 bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 22 h 49 m 44 sec
Reputation Power: 9
How to get dates in database to sort properly.

I am trying to have a list in my table output in the order they are loaded by date,

here is my code:
Code:
<!----------- Query DB -------------------->
<cfquery name="Resumes" datasource="Students">
SELECT * FROM Resume ORDER BY PostDate DESC
</cfquery>


But the dates that are output are all messed up, and not in order. Is there something I am missing?

Reply With Quote
  #2  
Old March 31st, 2004, 10:27 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Is postDate a date field or a string field?

Reply With Quote
  #3  
Old March 31st, 2004, 10:53 AM
bwedekin bwedekin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Dubai, UAE
Posts: 449 bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 22 h 49 m 44 sec
Reputation Power: 9
It's a date field.

Reply With Quote
  #4  
Old March 31st, 2004, 11:07 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
hmm...then I'm not sure. If the date field is holding a valid date value, using that field to order by should order the results by the date. How is the the ordering messed up?

Reply With Quote
  #5  
Old March 31st, 2004, 01:52 PM
bwedekin bwedekin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Dubai, UAE
Posts: 449 bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 22 h 49 m 44 sec
Reputation Power: 9
Output:

11/28/03
3/7/04
3/5/04
3/29/04
3/24/04
3/23/04
3/2/04
3/18/04
3/12/04
3/1/04
1/27/04
1/15/04
2/9/04
12/16/03

Reply With Quote
  #6  
Old March 31st, 2004, 02:19 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
I'm not sure what to tell you on this one. It seems to me there MUST be some problem in the way this has been stored in the database. What database are you using? What is the exact data type of the postdate field? Is it a timestamp field? date type? datetime?

I can run the same type of query on one of my tables:

select create_date from cm_task
order by create_date desc

and the results come back in exactly the right order. The create_date field is of Oracle type "date".

Reply With Quote
  #7  
Old March 31st, 2004, 02:51 PM
bwedekin bwedekin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Dubai, UAE
Posts: 449 bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 22 h 49 m 44 sec
Reputation Power: 9
It's an access database, and I think I figured it out.

The PostDate in the access database wasn't actually set to a Date Field, it was set at Memo .

All good now.

Reply With Quote
  #8  
Old March 31st, 2004, 03:33 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Quote:
Originally Posted by kiteless
Is postDate a date field or a string field?
That's what I was getting at with this question. Glad you got straightened out.

Reply With Quote
  #9  
Old March 31st, 2004, 03:58 PM
bwedekin bwedekin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Dubai, UAE
Posts: 449 bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level)bwedekin User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 22 h 49 m 44 sec
Reputation Power: 9
Quote:
Originally Posted by kiteless
That's what I was getting at with this question. Glad you got straightened out.


Yea, I must have changed it once without knowing....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > How to get dates in database to sort properly.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway