SELECT t.*, bt.name AS brand_name,
IFNULL(ct.name,'---') AS category_name, IFNULL(ct.lleft,0) AS category_left,
COUNT(_t.id) AS item_cnt
FROM (mod_catalog_itemgroups AS t,mod_catalog_brands AS bt,mod_catalog_itemgroup_segments AS sgt)
LEFT JOIN mod_catalog_cat_tree AS ct ON (t.category_id=ct.id)
LEFT JOIN mod_catalog_items AS _t ON (_t.item_group_id=t.id)
WHERE bt.id=t.brand_id AND t.brand_id=1 AND t.category_id=0 AND t.archive=0 AND sgt.itemgroup_id=t.id AND sgt.segment_id=12 GROUP BY t.id ORDER BY t.name LIMIT , [nativecode=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 '' at line 7]
list:SELECT t.*, bt.name AS brand_name,
IFNULL(ct.name,'---') AS category_name, IFNULL(ct.lleft,0) AS category_left,
COUNT(_t.id) AS item_cnt
FROM (mod_catalog_itemgroups AS t,mod_catalog_brands AS bt,mod_catalog_itemgroup_segments AS sgt)
LEFT JOIN mod_catalog_cat_tree AS ct ON (t.category_id=ct.id)
LEFT JOIN mod_catalog_items AS _t ON (_t.item_group_id=t.id)
WHERE bt.id=t.brand_id AND t.brand_id=1 AND t.category_id=0 AND t.archive=0 AND sgt.itemgroup_id=t.id AND sgt.segment_id=12 GROUP BY t.id ORDER BY t.name LIMIT ,