I have a large products database, and every sunday, my script is activating 50 new products. the thing is, based on some rules in my script, im finding some products i should pr
use FIELD
SELECT *
FROM products
order by FIELD(id,59,47,28,29,20), id desc
limit 50
Actually, your pseudo code also comes pretty close to such a query:
SELECT *
FROM products
order by id='59' desc, id='47' desc, id='28' desc, id='29' desc, id='20' desc, id desc
limit 50
This uses the fact that a condition evaluates to 0 or 1.