dev1234 dev1234 - 5 months ago 23
SQL Question

#1241 - Operand should contain 1 column(s)

i cannot find whats the issue here and why i am getting the error of #1241 - Operand should contain 1 column(s)

SELECT COUNT(*) FROM `User` `t`
INNER JOIN
(
SELECT cv.relatedId
FROM CustomValue cv
WHERE (cv.customFieldId=9 AND (cv.fieldValue = '1')) OR
(cv.customFieldId=8 AND (cv.fieldValue = '1'))
GROUP BY cv.relatedId
HAVING count(*) > 1
) tblcv
ON tblcv.relatedId = t.id
WHERE (firstName LIKE '%Jea%') AND (keywords like 52,53,54)


enter image description here

Answer

You should not use (keywords like 52,53,54).

You can use keywords in (52,53,54)

or keywords like '52,53,54'.

Edited:

Or maybe you want this;)

(find_in_set('52', keywords) or find_in_set('53', keywords) or find_in_set('54', keywords))

Or this keywords regexp '52|53|54', it all depends on your requirement.

Comments