任何想法都会有所帮助,我现在已经有一段时间了,只是无法弄清楚出了什么问题.
问题:查询工作正常,直到我在多字搜索中添加,您可以在下面看到粗体.但是,我回应了sql查询,然后粘贴在phpmyadmin,它工作得很好,但通过PHP它得到0记录.它没有任何意义,我无法弄清楚可能导致0结果的原因.
SELECT
DISTINCT c.id
FROM
carpets AS c
INNER JOIN carpet_relations AS r1 ON c.id = r1.carpet_id
INNER JOIN carpet_relations AS r2 ON c.id = r2.carpet_id
INNER JOIN carpet_relations AS r3 ON c.id = r3.carpet_id
WHERE
c.active = '1'
AND ((c.title LIKE '%north tabriz%') OR **(c.title LIKE '%north%') OR (c.title LIKE '%tabriz%')** OR (c.item_no LIKE '%north tabriz%') OR **(c.item_no LIKE '%north%') OR (c.item_no LIKE '%tabriz%')** OR (c.pattern LIKE '%north tabriz%') OR **(c.pattern LIKE '%north%') OR (c.pattern LIKE '%tabriz%')** OR …
Run Code Online (Sandbox Code Playgroud) 当列是创建的别名时,我无法弄清楚为什么我会得到一个未知列.任何帮助都会很棒.
码:
SELECT DISTINCT
c.id,
((SUM(c.width_feet)*12)+(SUM(c.width_inches))) AS width,
((SUM(c.height_feet)*12)+(SUM(c.height_inches))) AS height
FROM carpets AS c
WHERE c.active = '1'
AND (width BETWEEN '0' AND '275')
AND (height BETWEEN '0' AND '599')
ORDER BY c.item_no
Run Code Online (Sandbox Code Playgroud)
错误:
'where子句'中的未知列'width'