|
-
Mar 18th, 2002, 01:29 PM
#1
Thread Starter
PowerPoster
SQL statement needed
I'm suffering from real brain fade at the moment and I just can't figure this out.
We have 2 tables, customers and orders (one2many). What sql statement/s can I use to obtain the last order date for each customer
It seems so simple but I'm going mad 
Thanks
-
Mar 18th, 2002, 02:17 PM
#2
Frenzied Member
Code:
Select DISTINCT(CustomerName), max(b.OrderDate) from Customer a
Inner Join Orders b on b.CustomerID = a.CustomerID
Group By a.CustomerName
Order By a.CustomerName
I think that should do it!
seoptimizer2001
VB 6.0, VC++, VI, ASP, JavaScript, HTML,
Perl, XML, SQL Server 2000
If God had intended us to drink beer, He would have given us stomachs.
Please use the [code] and [vbcode] tags in your posts!
If you don't know how to use them please go HERE!

-
Mar 18th, 2002, 02:48 PM
#3
Thread Starter
PowerPoster
yeah!
Thanks a lot man, you are a lifesaver!!
-
Mar 18th, 2002, 03:33 PM
#4
Frenzied Member
Not a prob, I think we all have those days!
seoptimizer2001
VB 6.0, VC++, VI, ASP, JavaScript, HTML,
Perl, XML, SQL Server 2000
If God had intended us to drink beer, He would have given us stomachs.
Please use the [code] and [vbcode] tags in your posts!
If you don't know how to use them please go HERE!

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|