2016-06-07 128 views
0

我不能在這裏找到什麼問題,爲什麼我得到的#1241的錯誤 - 操作數應包含1列(S)#1241 - 操作數應包含1列(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

+0

可能的重複[錯誤#1241 - 操作數應包含1列(s)在MySQL中](http://stackoverflow.com/questions/16945867/error-1241-operand-should-contain-1-columns-in -mysql) – MusicLovingIndianGirl

+0

'像52,53,54'這樣的關鍵字?你是不是想用'in'代替? – Phil

回答

2

您不應該使用(keywords like 52,53,54)

您可以使用keywords in (52,53,54)

keywords like '52,53,54'

編輯:

或者,也許你想這一點;)

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

還是這個keywords regexp '52|53|54',這一切都取決於你的需求。

相關問題