SELECT GROUP_CONCAT(DISTINCT CONCAT(p.cod,'-',p.ordine,'-',IFNULL(po.ordine,'xx'),'-',p.promotional)) AS listaProduseSiOrdine, COUNT(DISTINCT p.cod) AS totalProduse FROM mv_produse p LEFT JOIN mv_produse_ordonare po ON (po.cod_produs=p.cod AND po.cod_categorie="234") LEFT JOIN mv_specificatii_produse sp ON (sp.cod_produs=p.cod AND sp.activ=1) INNER JOIN (SELECT cod_produs FROM mv_specificatii_produse WHERE cod_specificatie=94 AND activ=1 AND sters!=1 AND valoare IN (484,77,78,409,40mmin65-Willys-MB,-Mmmin38,-Ford-GPW,-CJmmin2---CJmmin3)) AS dVXAV94 ON sp.cod_produs=dVXAV94.cod_produs WHERE p.vizibil=1 AND FIND_IN_SET("234",REPLACE(p.cod_categorie,'|',','))>0 AND ( p.cod_producator=166 ) --> query
Array
(
    [0] => 42S22
    [1] => 1054
    [2] => Unknown column '40mmin65' in 'where clause'
)
Array
(
    [0] => 
SELECT
	GROUP_CONCAT(DISTINCT CONCAT(p.cod,'-',p.ordine,'-',IFNULL(po.ordine,'xx'),'-',p.promotional)) AS listaProduseSiOrdine,
	COUNT(DISTINCT p.cod) AS totalProduse
FROM mv_produse p

LEFT JOIN mv_produse_ordonare po ON (po.cod_produs=p.cod AND po.cod_categorie="234")
LEFT JOIN mv_specificatii_produse sp ON (sp.cod_produs=p.cod AND sp.activ=1)


			INNER JOIN (SELECT cod_produs FROM mv_specificatii_produse WHERE cod_specificatie=94 AND activ=1 AND sters!=1  AND valoare IN (484,77,78,409,40mmin65-Willys-MB,-Mmmin38,-Ford-GPW,-CJmmin2---CJmmin3)) AS dVXAV94 ON sp.cod_produs=dVXAV94.cod_produs

WHERE p.vizibil=1 AND FIND_IN_SET("234",REPLACE(p.cod_categorie,'|',','))>0

 AND (  p.cod_producator=166 )
)