1

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

dev1234
  • 5,376
  • 15
  • 56
  • 115
  • Possible duplicate of [Error #1241 - Operand should contain 1 column(s) in Mysql](http://stackoverflow.com/questions/16945867/error-1241-operand-should-contain-1-columns-in-mysql) – MusicLovingIndianGirl Jun 07 '16 at 04:42
  • `keywords like 52,53,54`? Did you mean to use `in` instead? – Phil Jun 07 '16 at 04:42

1 Answers1

3

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.

Blank
  • 12,308
  • 1
  • 14
  • 32