SELECT DISTINCT * FROM ( (SELECT 'forwarded' AS qfrom, NULL AS deals_id, NULL AS dealname, NULL AS oldprice, NULL AS offerprice, NULL AS endsat, products.*, 0 AS showorder, collectionname, collections.corder,categprods_order.porder AS prdorder, designers.`name` AS designame, designers.hideprices, designers.prefix, (SELECT instock FROM prodstocks WHERE prodstocks.products_id = products.id AND prodstocks.instock>0 LIMIT 1 ) AS instock , 0 AS onsale FROM categprods_order LEFT JOIN products ON ( products.id = categprods_order.products_id ) LEFT JOIN collections ON ( products.collections_id = collections.id ) LEFT JOIN designers ON ( designers.id = products.designers_id ) INNER JOIN prodimages ON ( prodimages.products_id = categprods_order.products_id ) INNER JOIN prodscolors ON (prodscolors.products_id=products.id) INNER JOIN colormap ON (colormap.id=prodscolors.colormaps_id) INNER JOIN prodsizes ON (products.id=prodsizes.products_id) WHERE categprods_order.categories_id = 20 AND (categprods_order.opage=195 OR categprods_order.opage=0) AND categprods_order.products_id>0 AND products.id=prodscolors.products_id AND prodscolors.colormaps_id=colormap.id GROUP BY prodimages.products_id ) UNION (SELECT 'deals' AS qfrom, deals.id AS deals_id, deals.dealname, deals.oldprice, deals.offerprice, deals.endsat, products.*, 1 AS showorder, collectionname, collections.corder, NULL AS prdorder, designers.`name` AS designame, designers.hideprices, designers.prefix, (deals.isinstock =1) AS instock, 0 AS onsale FROM products, deals , prodscategs,collections,designers,prodimages, categories, prodscolors, colormap,prodsizes WHERE products.id = prodscategs.products_id AND prodsizes.products_id = products.id AND products.collections_id = collections.id AND designers.id = products.designers_id AND products.id = prodimages.products_id AND categories.id=prodscategs.categories_id AND prodscategs.categories_id = 20 AND deals.products_id=products.id AND deals.published = 1 AND deals.endsat >= curDate() AND products.id=prodscolors.products_id AND prodscolors.colormaps_id=colormap.id GROUP BY prodimages.products_id LIMIT 0 ,0 ) UNION (SELECT 'collec' AS qfrom, NULL AS deals_id, NULL AS dealname, NULL AS oldprice, NULL AS offerprice, NULL AS endsat, products.*, 2 AS showorder, collectionname, collections.corder, FIELD(products.id, ) AS prdorder, designers.`name` AS designame, designers.hideprices, designers.prefix, (SELECT instock FROM prodstocks WHERE prodstocks.products_id = products.id AND prodstocks.instock>0 LIMIT 1 ) AS instock , 0 AS onsale FROM products, prodscategs, collections,designers,prodimages, prodscolors, colormap, prodsizes WHERE products.collections_id = collections.id AND products.id = prodscategs.products_id AND designers.id = products.designers_id AND products.id = prodsizes.products_id AND products.id = prodimages.products_id AND products.id=prodscolors.products_id AND prodscolors.colormaps_id=colormap.id AND products.id IN () AND categories_id = 20 GROUP BY prodimages.products_id ORDER BY prdorder ) ) AS Category ORDER BY Category.showorder ASC, Category.prdorder, Category.corder, stylenum ASC LIMIT 29 ;

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS prdorder, designers.`name` AS des' at line 64
#0 /home/devparisdress/public_html/modules/Category/Category.php(469): DataBase->query('SELECT DISTINCT...')
#1 /home/devparisdress/public_html/templates/backnwhite/category_backnwhite.inc(41): Category->loadPage(194, true, false, true, 2)
#2 /home/devparisdress/public_html/dispatcher.php(424): include_once('/home/devparisd...')
#3 {main}