-
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
-
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!
-
yeah!
Thanks a lot man, you are a lifesaver!!
:D
-
Not a prob, I think we all have those days!