File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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: 601


Product
ProductID ProductName

Customer
CustomerID FirstName LastName

Orders
OrderID, CustomerID

Order Details
OrderDetailID OrderID ProductID
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601

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: 3611
    
  60

Just adding p.ProductName and o.PurchaseDateTime to you GROUP BY clause might work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the last purchased product?