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 '%Libros%Escolares%(Pre%K%-12)%' )%' OR `KEYWORDS` LIKE '%Libros%Escolare' at line 142

SELECT p.KIOSK_ID, u.FB_UID, u.ZIP, `PRODUCT_ID` as `PRODUCT_ID`, `PRODUCT_NAME` as `PRODUCT_NAME`, (MATCH (p.DESCRIPTION, p.PRODUCT_NAME) AGAINST (' >"Libros Escolares (Pre K -12)" Libros Escolares (Pre K -12) ') ) as `RELEVANT`, CASE k.TYPE WHEN 'kiosk' THEN 'Kiosko' WHEN 'business' THEN 'Negocio' END as `TYPE`, `CAT_NAME`, ( SELECT `CSS_CLASS` FROM `categories` WHERE `CAT_ID`=c.PARENT_ID ) as `PARENT_CSS_CLASS`, ( SELECT `CAT_NAME` FROM `categories` WHERE `CAT_ID`=c.PARENT_ID ) as `PARENT_CAT_NAME`, pr.city_name as `CITY_NAME`,CASE p.SALE WHEN '1' THEN 'Precio Fijo' END as `SALE`, CASE p.OFFER WHEN '1' THEN 'Mejor Oferta' END as `OFFER`, CASE p.TRADE WHEN '1' THEN 'Intercambiar' END as `TRADE`,HIDE_PRICE, BASE_PRICE,ISBN,CASE p.CONDITION WHEN 'new' THEN 'Nuevo' WHEN 'used' THEN 'Usado' ELSE p.CONDITION END as `CONDITION`, CASE WHEN (SELECT `RATING` FROM `kiosk_ratings` WHERE `KIOSK_ID`=k.KIOSK_ID) = 5 THEN 'a Vendedor de 5 Estrellas' WHEN (SELECT `RATING` FROM `kiosk_ratings` WHERE `KIOSK_ID`=k.KIOSK_ID) > 4 THEN 'b Vendedor de 4 Estrellas' WHEN (SELECT `RATING` FROM `kiosk_ratings` WHERE `KIOSK_ID`=k.KIOSK_ID) > 3 THEN 'c Vendedor de 3 Estrellas' WHEN (SELECT `RATING` FROM `kiosk_ratings` WHERE `KIOSK_ID`=k.KIOSK_ID) > 2 THEN 'd Vendedor de 2 Estrellas' WHEN (SELECT `RATING` FROM `kiosk_ratings` WHERE `KIOSK_ID`=k.KIOSK_ID) > 0 THEN 'e Vendedor de 1 Estrella' ELSE 'f Kiosko Nuevo' END as `KIOSK_RATING`,CASE WHEN (SELECT COUNT(*) FROM `images` as img WHERE p.PRODUCT_ID=img.PRODUCT_ID) > 0 THEN 'Con Fotos Solamente' ELSE 'Sin Fotos' END as `PICTURES`,CASE WHEN `PRICE`<25 THEN 'a $0 - $24.99' WHEN `PRICE`<50 THEN 'b $25 - $49.99' WHEN `PRICE`<75 THEN 'c $50 - $74.99' WHEN `PRICE`<100 THEN 'd $75 - $99.99' WHEN `PRICE`<200 THEN 'e $100 - $199.99' WHEN `PRICE`<300 THEN 'f $200 - $299.99' WHEN `PRICE`<400 THEN 'g $300 - $399.99' WHEN `PRICE`<500 THEN 'h $400 - $499.99' WHEN `PRICE`<750 THEN 'i $500 - $749.99' WHEN `PRICE`<1000 THEN 'j $750 - $999.99' WHEN `PRICE`<1500 THEN 'k $1,000 - $1,499.99' WHEN `PRICE`<2000 THEN 'l $1,500 - $1,999.99' WHEN `PRICE`<2500 THEN 'm $2,000 - $2,499.99' WHEN `PRICE`<3000 THEN 'n $2,500 - $2,999.99' WHEN `PRICE`<3500 THEN 'o $3,000 - $3,499.99' WHEN `PRICE`<4000 THEN 'p $3,500 - $3,999.99' WHEN `PRICE`<4500 THEN 'q $4,000 - $4,499.99' WHEN `PRICE`<5000 THEN 'r $4,500 - $4,999.99' WHEN `PRICE`<7500 THEN 's $5,000 - $7,499.99' WHEN `PRICE`<10000 THEN 't $7,500 - $9,999.99' WHEN `PRICE`<15000 THEN 'u $10,000 - $14,999.99' WHEN `PRICE`<20000 THEN 'v $15,000 - $19,999.99' WHEN `PRICE`<25000 THEN 'w $20,000 - $24,999.99' WHEN `PRICE`<35000 THEN 'x $25,000 - $34,999.99' WHEN `PRICE`<50000 THEN 'y $35,000 - $49,999.99' WHEN `PRICE`<75000 THEN 'z $50,000 - $74,999.99' WHEN `PRICE`<100000 THEN 'za $75,000 - $99,999.99' WHEN `PRICE`<150000 THEN 'zb $100,000 - $149,999.99' WHEN `PRICE`<200000 THEN 'zc $150,000 - $199,999.99' WHEN `PRICE`<300000 THEN 'zd $200,000 - $299,999.99' WHEN `PRICE`<400000 THEN 'ze $300,000 - $399,999.99' WHEN `PRICE`<500000 THEN 'zf $400,000 - $499,999.99' WHEN `PRICE`<750000 THEN 'zg $500,000 - $749,999.99' WHEN `PRICE`<1000000 THEN 'zh $750,000 - $999,999.99' ELSE 'zi $1,000,000 +' END as `PRICE_RANGE`,`KEYWORDS`,`DESCRIPTION`,CASE WHEN `AREA`<500 THEN 'a 499 pies o menos' WHEN `AREA`<1000 THEN 'b 500 - 999 pies' WHEN `AREA`<2000 THEN 'c 1000 - 1999 pies' WHEN `AREA`<3000 THEN 'd 2000 - 2999 pies' ELSE 'e 3000 pies o mas' END as `AREA_RANGE`,CASE WHEN `LANDLOT`<500 THEN 'a 499 metros o menos' WHEN `LANDLOT`<1000 THEN 'b 500 - 999 metros' WHEN `LANDLOT`<2000 THEN 'c 1000 - 1999 metros' WHEN `LANDLOT`<3000 THEN 'd 2000 - 2999 metros' ELSE 'e 3000 metros o mas' END as `LANDLOT_RANGE`,CASE WHEN `BATHROOMS`='4' THEN '4+ Ba' WHEN `BATHROOMS`='3.5' THEN '3.5 Ba' WHEN `BATHROOMS`='3' THEN '3 Ba' WHEN `BATHROOMS`='2.5' THEN '2.5 Ba' WHEN `BATHROOMS`='2' THEN '2 Ba' WHEN `BATHROOMS`='1.5' THEN '1.5 Ba' WHEN `BATHROOMS`='1' THEN '1 Ba' WHEN `BATHROOMS`='.5' THEN '.5 Ba' ELSE 'No Aplica' END as `BATHROOM_RANGE`,CASE WHEN `ROOMS`='' THEN 'No Aplica' WHEN `ROOMS`='1' THEN '1 Hab2' ELSE CONCAT( `ROOMS`, ' Habitaciones' ) END as `ROOMS_RANGE`,`YEAR`,`MILEAGE`,CASE WHEN `MILEAGE`BETWEEN 1 AND 1000 THEN 'a 1-999 millas' WHEN `MILEAGE`<5000 THEN 'b 1,000-4,999 millas' WHEN `MILEAGE`<10000 THEN 'c 5,000-9,999 millas' WHEN `MILEAGE`<20000 THEN 'd 10,000-19,999 millas' WHEN `MILEAGE`<35000 THEN 'e 20,000-34,999 millas' WHEN `MILEAGE`<50000 THEN 'f 35,000-49,999 millas' WHEN `MILEAGE`<75000 THEN 'g 50,000-74,999 millas' WHEN `MILEAGE`<100000 THEN 'h 75,000-99,999 millas' WHEN `MILEAGE`<125000 THEN 'i 100,000-124,999 millas' WHEN `MILEAGE`<150000 THEN 'j 125,000-149,999 millas' WHEN `MILEAGE`<200000 THEN 'k 150,000-199,999 millas' WHEN `MILEAGE`<250000 THEN 'l 200,000-249,999 millas' WHEN `MILEAGE`>250000 THEN 'm 250,000 y mas millas' END as `MILEAGE_RANGE`,CASE WHEN `YEAR` BETWEEN 1800 AND 1970 THEN '1969 o antes' WHEN `YEAR`<1980 THEN '1970-1979' WHEN `YEAR`<1985 THEN '1980-1984' WHEN `YEAR`<1990 THEN '1985-1989' WHEN `YEAR`<1995 THEN '1990-1994' WHEN `YEAR`<2000 THEN '1995-1999' WHEN `YEAR`<2005 THEN '2000-2004' WHEN `YEAR`<2010 THEN '2005-2009' WHEN `YEAR`<2015 THEN '2010-2014' WHEN `YEAR`<2020 THEN '2015-2019' WHEN `YEAR`<2025 THEN '2020-2024' WHEN `YEAR`<2030 THEN '2025-2029' ELSE '2030+' END as `YEAR_RANGE`,`PRICE`FROM `products_available_view` as p JOIN `kiosk` as k JOIN `users` as u JOIN `categories` AS c JOIN `pr_cities` as pr WHERE p.CATEGORY = c.CAT_ID AND p.KIOSK_ID=k.KIOSK_ID AND (1=1 ) AND k.USER_ID=u.USER_ID AND CASE WHEN p.CATEGORY IN (277, 278, 279, 280, 281) THEN p.ZIPCODE=pr.city_zip ELSE u.ZIP=pr.city_zip END AND DATEDIFF(NOW(),EDIT_DATE)<'90' AND ( `PRODUCT_NAME` LIKE '%Libros%Escolares%(Pre%K%-12 OR `ISBN` LIKE '%Libros%Escolares%(Pre%K%-12)%' )%' OR `KEYWORDS` LIKE '%Libros%Escolares%(Pre%K%-12 OR `ISBN` LIKE '%Libros%Escolares%(Pre%K%-12)%' )%' OR `DESCRIPTION` LIKE '%Libros%Escolares%(Pre%K%-12 OR `ISBN` LIKE '%Libros%Escolares%(Pre%K%-12)%' )%' OR `ISBN` LIKE '%Libros%Escolares%(Pre%K%-12)%' )ORDER BY `RELEVANT` DESC, EDIT_DATE DESC, PRODUCT_ID DESC