I want to get cases of wine where each bottle is between $4 and $8. The costs in the products table are all in cases of 12. Easy huh?
SELECT `id`
FROM `products`
WHERE (`cost` / 12) > 4
AND (`cost` / 12) < 8
Now, they are beginning to sell cases of 6. Assume that this is defined only in the title string with 6 pack
.
How do I write my query so it selects all cases of wine where price / 12 is in range, or if the title string contains 6 pack
, divide by 6 instead.
Is this possible in one query?
Thanks