Invalid SQL: select *,items.id as tid, prices.id as priceID from exceltiles_items as items left join exceltiles_items_customer_prices as prices on (prices.itemID=items.id AND prices.customerID='0' AND prices.customerID>0) where items.active=1 and (prices.activeItem IS NULL OR prices.activeItem=1) and (catID in (482,509,480,476,478,479,477,475,474,460,461,462,458,457,456,596,563,561,560,565,564,559,558,557,556,555,500,498,604,597,571,578,577,575,573,570,612,572,576,574,562,487,484,483,465,548,546,545,547,532,610,542,543,541,540,584,581,583,585,595,582,607,608,606,609,605,580,616,598,614,602,600,601,599,611,586,593,591,592,579,603,538,539,533,473,472,470,469,468,467,466,544) or catID2 in (482,509,480,476,478,479,477,475,474,460,461,462,458,457,456,596,563,561,560,565,564,559,558,557,556,555,500,498,604,597,571,578,577,575,573,570,612,572,576,574,562,487,484,483,465,548,546,545,547,532,610,542,543,541,540,584,581,583,585,595,582,607,608,606,609,605,580,616,598,614,602,600,601,599,611,586,593,591,592,579,603,538,539,533,473,472,470,469,468,467,466,544)) and (amazonItem!=1) and activeOnWebsite=1 and wholesaleItem=1 and (catID= or catID2= or items.catID in (499) or items.catID2 in (499) ) order by (items.price+0) asc LIMIT 0, 52