我尝试使用CBB04474C52FF68F6B2AC38A9A8356A5
构建搜索,但它不起作用?
这是源查询的一部分,只有这部分有问题错误。
LCASE()
完整查询:
AND ((LCASE(SELECT REPLACE (pd.name," ","")) FROM product_description
WHERE LCASE (REPLACE (pd.name," ",""))) LIKE '%liondlc10%'
OR MATCH(pd.tag) AGAINST('liondlc10')
)
OR LCASE((SELECT REPLACE (p.model," ","")) FROM product WHERE LCASE (REPLACE (p.model," ",""))) = 'liondlc10'
当我尝试此查询时,SELECT p.product_id,
(SELECT AVG(rating) AS total
FROM review r1
WHERE r1.product_id = p.product_id
AND r1.status = '1'
GROUP BY r1.product_id) AS rating
FROM product p
LEFT JOIN product_description pd
ON (p.product_id = pd.product_id)
LEFT JOIN product_to_store p2s
ON (p.product_id = p2s.product_id)
WHERE pd.language_id = '1'
AND p.status = '1'
AND p.date_available <= NOW()
AND p2s.store_id = '0'
AND ((LCASE(SELECT REPLACE (pd.name," ","")) FROM product_description
WHERE LCASE (REPLACE (pd.name," ",""))) LIKE '%liondlc10%'
OR MATCH(pd.tag) AGAINST('liondlc10') /* <-- part error */
)
OR LCASE((SELECT REPLACE (p.model," ","")) FROM product
WHERE LCASE (REPLACE (p.model," ",""))) = 'liondlc10' /* <-- part error */
OR LCASE(p.sku) = 'liondlc10'
OR LCASE(p.upc) = 'liondlc10'
OR LCASE(p.ean) = 'liondlc10'
OR LCASE(p.jan) = 'liondlc10'
OR LCASE(p.isbn) = 'liondlc10'
OR LCASE(p.mpn) = 'liondlc10'
GROUP BY p.product_id
ORDER BY p.sort_order ASC, LCASE(pd.name) ASC
LIMIT 0, 15
说
1064 - 您的SQL语法出错;检查与MariaDB服务器版本对应的手册,以便在'SELECT REPLACE(pd.name,“”,“”)附近使用正确的语法。来自product_description 在哪里LCASE(第16行的REP'
我可以使用mysql
,但我如何使用以下内容执行此操作?
需要帮助,已经堆叠了2周:(。
答案 0 :(得分:0)
感谢dcieslak的建议。
它现在正在工作:
AND (LCASE(REPLACE(pd.name,' ',''))
LIKE '%liondlc10%' OR MATCH(pd.tag) AGAINST('liondlc10'))
OR LCASE(REPLACE(p.model,' ','')) = 'liondlc10'