Expression #1 of ORDER BY clause is not in SELECT list, references column 'agroconex.p.p_ordine' which is not in SELECT list; this is incompatible with DISTINCT (SELECT DISTINCT(p_id), p_denumire FROM t_articole AS a
INNER JOIN t_producatori AS p ON art_p_id=p_id
INNER JOIN t_catalog_categorii AS c ON art_categorie=cc_id
WHERE 1 AND p_status=1 AND art_categorie IN (16)
ORDER BY p_ordine)