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 ') group by p.products_id order by pqty_sorter desc,products_price_sorter asc' at line 13
in:
[select p.products_image, p.products_model,pd.products_name, p.products_quantity as pid_qty,
GROUP_CONCAT((p.stock_no+ coalesce(pa.stock_no,0)) SEPARATOR ','),
sum(ptqty.curr_stock) as products_quantity,IF(sum(ptqty.curr_stock) > 0, 1, 0) as pqty_sorter,
p.products_id, p.products_price_sorter,
p.products_type, p.master_categories_id, p.manufacturers_id, p.products_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 pq.stock_no,(pqty-coalesce(os.pending_qty,0))as curr_stock from (SELECT stock_no,sum(qty) pqty from pos_qty group by stock_no) pq left join (
select op.stock_no,sum(op.products_quantity) as pending_qty from orders_products op,orders o where op.orders_id=o.orders_id and o.orders_status=1
and op.stock_no>0 group by stock_no) os on os.stock_no=pq.stock_no) ptqty on (p.stock_no+coalesce(pa.stock_no,0))=ptqty.stock_no, products_to_categories p2c left join specials s on p2c.products_id = s.products_id where p.products_status =
1 and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id in( 531,) group by p.products_id order by pqty_sorter desc,products_price_sorter asc]
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 ') group by p.products_id order by pqty_sorter desc,products_price_sorter asc' at line 13
select p.products_image, p.products_model,pd.products_name, p.products_quantity as pid_qty,
GROUP_CONCAT((p.stock_no+ coalesce(pa.stock_no,0)) SEPARATOR ','),
sum(ptqty.curr_stock) as products_quantity,IF(sum(ptqty.curr_stock) > 0, 1, 0) as pqty_sorter,
p.products_id, p.products_price_sorter,
p.products_type, p.master_categories_id, p.manufacturers_id, p.products_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 pq.stock_no,(pqty-coalesce(os.pending_qty,0))as curr_stock from (SELECT stock_no,sum(qty) pqty from pos_qty group by stock_no) pq left join (
select op.stock_no,sum(op.products_quantity) as pending_qty from orders_products op,orders o where op.orders_id=o.orders_id and o.orders_status=1
and op.stock_no>0 group by stock_no) os on os.stock_no=pq.stock_no) ptqty on (p.stock_no+coalesce(pa.stock_no,0))=ptqty.stock_no, products_to_categories p2c left join specials s on p2c.products_id = s.products_id where p.products_status =
1 and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id in( 531,) group by p.products_id order by pqty_sorter desc,products_price_sorter asc