Error in Query on db f174638, MySql 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 '-12' at line 34
Query: SELECT itm.item_id,
itm.title,
itm.head,
itm.price,
itm.price_initial,
pcat.price_category_id,
pcat.name as price_category_name,
pcat.title as price_category_title,
pcat.description as price_category_description
FROM item itm
LEFT JOIN (
SELECT MAX(subpric.price_category_id) price_category_id, itmcat.item_id
FROM item_category itmcat
JOIN subcategory sub ON itmcat.subcategory_id = sub.subcategory_id
JOIN subcategory_pricing subpric ON sub.subcategory_id = subpric.subcategory_id
GROUP BY itmcat.item_id
) pricat ON pricat.item_id = itm.item_id
LEFT JOIN price_category pcat ON pricat.price_category_id = pcat.price_category_id
WHERE itm.item_id IN (
SELECT itmcat.item_id
FROM item_category itmcat
WHERE (CASE
WHEN '391' = '0' AND '99' = 0
THEN 1=1
WHEN '391' = '0'
THEN itmcat.category_id = '99'
ELSE itmcat.subcategory_id = '391'
END)
)
AND published = 1
AND language_id = '2'
ORDER BY itm.rank DESC, itm.item_id DESC
LIMIT 12 OFFSET -12