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,563,561,560,565,564,559,558,557,556,555,500,498,571,578,577,575,573,570,572,576,574,562,497,496,495,491,494,504,493,492,490,489,503,488,487,485,501,502,486,484,483,465,548,546,545,547,532,542,543,541,540,584,581,583,585,582,580,586,593,591,592,579,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,563,561,560,565,564,559,558,557,556,555,500,498,571,578,577,575,573,570,572,576,574,562,497,496,495,491,494,504,493,492,490,489,503,488,487,485,501,502,486,484,483,465,548,546,545,547,532,542,543,541,540,584,581,583,585,582,580,586,593,591,592,579,538,539,533,473,472,470,469,468,467,466,544)) and (amazonItem!=1) and activeOnWebsite=1 and wholesaleItem=1 and items.sourceID=6 and (catID= or catID2= or items.catID in (499) or items.catID2 in (499) ) order by (items.price+0) asc LIMIT 0, 52