php - SQL MAX and same coupon
I'm using this sql line to pull latest coupon:
SELECT * FROM `coupons` WHERE `sku` = '123456' AND `id` IN (SELECT Max(id) FROM `coupons` GROUP BY coupon) ORDER BY `id` DESC LIMIT 3
It's working good, but in rare situations when i have same coupon code on different sku the results is nothing.
How can i solve this?