An Error Was Encountered

Error Number: 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 store_item.id order by stock_sign DESC, time DESC, id DESC limit 0 , 50' at line 1

select store_item.*, store_item_brand.title as brand_title, SUM(stock) as stock, SIGN(SUM(stock)) as stock_sign from store_item inner join store_item_brand on store_item.brand = store_item_brand.id left join store_item_stock on store_item.id = item_id WHERE store_item.`sort` = '19' AND store_item.size=default group by store_item.id order by stock_sign DESC, time DESC, id DESC limit 0 , 50