Select t1.cat_id, t1.id, t2.* from
(Select cat_id, min(id) from table group by cat_id
UNION
Select cat_id, min(id) from table
where id not in (Select min(id) from table group by cat_id) group by cat_id) t1
left join table t2 on t1.id = t2.id
SELECT t1.id, Автомобили.name, t1.category_id from
(
SELECT MAX(id) as id, category_id FROM Автомобили WHERE category_id IN
(SELECT id FROM Категории WHERE parent_id = 0)
GROUP BY category_id
) t1 left join Автомобили on Автомобили.id = t1.id
Select idпродукта from
(
Select idпродукта from table where
(Значение = 200 and Idатрибута = 2 ) or
(Значение = 10 and Idатрибута = 3) or
(Значение = "Ель" and Idатрибута = 1)
) t1
group by idпродукта
having count(idпродукта)>2