Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb Site ManagementScripts

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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 21st, 2005, 10:42 PM
Big Kev Big Kev is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Brisbane Australia
Posts: 8 Big Kev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 24 sec
Reputation Power: 0
Date selection problem

Can someone please help me out


What I would like to do is select the most recent date for a field that has multiple entries.

TBL = EMSAL
Select * FROM EMSAL WHERE ????
Example:

Number Date Increase Percent
10000 01/01/2003 2500 10%
10000 10/10/2003 500 2%
10000 31/12/2003 1000 6%


The "Number" is common , the "Increase" is ramdom as well as the "Percent". As per the example there are 3 entries for Number 10000, I only want the most recent date to come through in my query results.


Required result is :
Number Date Increase Percent
10000 31/12/2003 1000 6%


Your help is greatly appreciated.

Regards
Big Kev

Reply With Quote
  #2  
Old March 21st, 2005, 11:58 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,266 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 23 h 15 m 4 sec
Reputation Power: 744
You need to use a proper DATE fieldtype for the database you're using. This will allow you to
Code:
SELECT * FROM EMSAL ORDER BY `date` DESC LIMIT 1

Reply With Quote
  #3  
Old March 22nd, 2005, 12:32 AM
Big Kev Big Kev is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Brisbane Australia
Posts: 8 Big Kev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 24 sec
Reputation Power: 0
Quote:
Originally Posted by jharnois
You need to use a proper DATE fieldtype for the database you're using. This will allow you to
Code:
SELECT * FROM EMSAL ORDER BY `date` DESC LIMIT 1

Thanks for that


The table is set to datetime

is the query supposed to look like this?

SELECT *FROM EMSAL ORDER BY 'SMN_DATEC ' LIMIT 1

Thanks

Reply With Quote
  #4  
Old March 22nd, 2005, 12:36 AM
Big Kev Big Kev is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Brisbane Australia
Posts: 8 Big Kev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 24 sec
Reputation Power: 0
One more thing i forgot to mention is that the date can differ between different numbers. So I can not just use one date to look for

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > Date selection problem


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 6 hosted by Hostway