1064 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 '569,564,562) group by p.products_id order by pqty_sorter desc,p
in:
[select p.products_image, p.products_model,pd.products_name, p.products_quantity as pid_qty,sum(ptqty.curr_stock) as products_quantity,IF(sum(ptqty.curr_stock) > 0, 1, 0) as pqty_sorter, p.products_id,p.width,p.height,p.depth, p.products_price_sorter, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price,p.landing_price, p.products_tax_class_id,pd.products_description, mtpd.metatags_img_alt_keywords, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status from products_description pd left join meta_tags_products_description mtpd using(products_id,language_id) , products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_attributes pa on p.products_id=pa.products_id left join (select products_id,paid as products_attributes_id,avaliable_quantity - COALESCE( pending_quantity,0) as curr_stock,avaliable_quantity,pending_quantity from (select products_id,coalesce(products_attributes_id,0) as paid,GROUP_CONCAT(atw.tagno) as tagno_list, SUM((IF(cor_it.issdate IS NULL,1,0) * IF(kkk_it.issdate IS NULL,1,0) * IF(tac_it.issdate IS NULL,1,0) * IF(cor_it.approval != '',0,1)* IF(kkk_it.approval != '',0,1)* IF(tac_it.approval !='',0,1) * IF(cor_it.ordrepno != '',0,1)* IF(kkk_it.ordrepno != '',0,1)* IF(tac_it.ordrepno != '',0,1) * IF(cor_it.itemctrid not in ('9','10','11','13','16','17','20','22','23'),1,0) * IF(COALESCE(kkk_it.itemctrid,0) not in ('9','10','11','13','16','17','20','22','23'),1,0) * IF(COALESCE(tac_it.itemctrid,0) not in ('9','10','11','13','16','17','20','22','23'),1,0) )) avaliable_quantity from aks_to_web atw ,aks_coradmindb.aks_itemtag cor_it left outer join aks_kkkadmindb.aks_itemtag kkk_it on cor_it.sno=kkk_it.sno left outer join aks_tacadmindb.aks_itemtag tac_it on cor_it.sno=tac_it.sno where atw.tagno=cor_it.tagno group by products_id,products_attributes_id) pq left join (select o.orders_id,op.orders_products_id ,coalesce( opa.orders_products_attributes_id,0) as opaid,op.products_quantity as pending_quantity from orders_products op left outer join orders_products_attributes opa using(orders_id,orders_products_id) , orders o where o.orders_id = op.orders_id and o.orders_status in (1,5) ) pending on pq.products_id=pending.orders_products_id and pq.paid=pending.opaid ) ptqty on p.products_id=ptqty.products_id and COALESCE(pa.products_attributes_id,0)=ptqty.products_attributes_id, products_to_categories p2c left join specials s on p2c.products_id = s.products_id where p.products_status =1 and pending_product_image_attachement=0 and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id in( 571,575,572,576,573,574,565,,569,564,562) group by p.products_id order by pqty_sorter desc,products_price_sorter asc]