As you can see I would like to get the latest purchase order for each SKU.
Sample Data
I have this data set,
CREATE TABLE PurchaseOrders (
id int PRIMARY KEY AUTO_INCREMENT,
sku varchar(6),
purchase_date date
);
INSERT INTO PurchaseOrders VALUES
( 1, 'ABC123', '2017-12-23' ),
( 2, 'ABC123', '2016-11-11' ),
( 3, 'DEF456', '2011-01-03' ),
( 4, 'DEF456', '2011-10-21' ),
( 5, 'GHI789', '2017-01-23' ),
( 6, 'GHI789', '2017-11-21' );
Desired Result
1 | ABC123 | 2017-12-23
4 | DEF456 | 2011-10-21
6 | GHI789 | 2017-11-21