aspose file tools*
The moose likes JDBC and the fly likes How to get the last purchased product? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to get the last purchased product?" Watch "How to get the last purchased product?" New topic
Author

How to get the last purchased product?

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598


Product
ProductID ProductName

Customer
CustomerID FirstName LastName

Orders
OrderID, CustomerID

Order Details
OrderDetailID OrderID ProductID
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598

Here is the most refined version, but I can't get repeated purchased items for each order.
There is only one order item listed.

I'd like to get
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Just adding p.ProductName and o.PurchaseDateTime to you GROUP BY clause might work.
 
Consider Paul's rocket mass heater.
 
subject: How to get the last purchased product?