VAŠ EKSPERT ZA KUHINJU

Zatvori
SELECT t1.id, t1.primaran, t1.naziv, t1.mpcena, t1.ascase FROM (SELECT a.id,a.primaran,a.naziv,a.mpcena,1 as ascase FROM `artikli` a WHERE a.`id`!='0' AND a.parent_id IS NULL AND a.`naziv` LIKE '%FLEXON II%' AND a.`novo`!='on' AND a.`aktivan`='on' AND a.`mpcena`!='0.00' AND a.`prikaz_b2c`='on' UNION SELECT a.id,a.primaran,a.naziv,a.mpcena,1 as ascase FROM `artikli` a WHERE a.`id`!='0' AND a.parent_id IS NULL AND a.`naziv` LIKE '%FLEXON II%' AND a.`novo`!='on' AND a.`aktivan`='on' AND a.`mpcena`!='0.00' AND a.`prikaz_b2c`='on' UNION SELECT a.id,a.primaran,a.naziv,MIN(a.mpcena) as mpcena,1 as ascase FROM artikli a INNER JOIN artikli a2 ON a2.id = a.parent_id WHERE a.`id`!='0' AND a.parent_id IS NOT NULL AND a.`naziv` LIKE '%FLEXON II%' AND a.`novo`!='on' AND a.`aktivan`='on' AND a.`mpcena`!='0.00' AND a.`prikaz_b2c`='on' GROUP BY a.parent_id ) t1 ORDER BY ascase ASC, `id` DESC