Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select * from generic_shop
- where (type, timestamp) in (
- select type, max(timestamp)
- from generic_shop
- group by type
- ) order by type
- SELECT g1.*
- FROM generic_shop g1
- INNER JOIN
- (
- SELECT type, MAX(timestamp) AS max_timestamp
- FROM generic_shop
- GROUP BY type
- ) g2
- ON g1.type = g2.type AND g1.timestamp = g2.max_timestamp;
- ORDER BY
- g1.type;
Add Comment
Please, Sign In to add comment