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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query help on expression? Need Last Date

Status
Not open for further replies.

hvns

Technical User
Oct 2, 2007
25
US
Hello,

I am trying to make a query on a table that has multiple dates for a specific number...

Example
Order # 1234 has shipped multiple times over a period to completed the order:

Order# Due Date Date Shipped
1234 1/1/08 12/31/07
1234 1/1/08 1/1/08
1234 1/1/08 2/15/08


I want it to only return the last date... te record with 2/15/08 not the others... some help or pointing me int he right direction would be greatly apprecaited...

THanks.
John
 


Hi,
Code:
Select
Order#, [Due Date], Max([Date Shipped])
...
Group By 
Order#, [Due Date]

Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
thank you very much... it is frustrating trying somethings that are very simple after not doing them for 6-7 years...

much appreciated..

John
 
BTW,

Having Order# and Order Due Date in the same table along with multiple Order Ship Dates, is not a best and accepted database design.


Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
I agree but Since I can only access this data through a ReadOnly ODBC - that data base was set up by antoher company / application so i have to work with what I have and make it flow... MAS90 - until I can get more / better trainging with their tools...

I totally agree with you...
 



Ya gotta do what ya gotta do!

Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top