By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Get the latest record for each cust no.

P: 1
Hi All,
My table appears like this with the following columns:

Name CUSTNo ORderNo. AcctDate OrderDate OrderDescription

I would like to write a ms-sql query to return the records of each customer number with the latest OrderDate. One more thing, if the customer has two separate order numbers on the same date(provided its the latest date), the query should be able to pull up both the records. Thank You
Jul 27 '13 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,430
Join it to an aggregate query that returns the max order date grouped by the customer number.
Jul 28 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.