select * from products
order by type ASC
( case type = 'books' then id desc case type ="food" then name asc price desc case type="relax" popular asc, id desc end)
select *
from products
order by type ASC,
case WHEN type = 'books' then id ELSE 0 END desc,
case WHEN type = "food" then name ELSE 0 END asc,
case WHEN type = "food" then price ELSE 0 END desc,
case WHEN type = "relax" THEN popular ELSE 0 END asc,
case WHEN type = "relax" THEN id ELSE 0 END desc