[英]Operand should contain 1 column(s) Database error
Hi guys I know this has been answered on here in a number of threads, but I just can't figure out what the error is in my query. 嗨,大家好,我知道这已经在许多线程中得到了解答,但是我无法弄清楚查询中的错误是什么。 I get the error 'Operand should contain 1 column(s)'.
我收到错误“操作数应包含1列”。 Looks like a monster of a query I'm building here, and any help will be appreciated:
看起来像我在这里构建的查询的怪物,任何帮助将不胜感激:
SELECT u.* FROM (
(SELECT fx_users.id, CONCAT_WS(' ', last_name, first_name) as matched_field, 'person' as type
FROM fx_users
LEFT JOIN fx_profiles ON fx_profiles.user_id = fx_users.id
WHERE (fx_profiles.first_name, fx_profiles.last_name, fx_profiles.research_area LIKE '%a%'
OR fx_profiles.bio LIKE '%a%'
OR fx_profiles.institution LIKE '%a%'
OR fx_profiles.faculty LIKE '%a%'
OR fx_profiles.faculty_position LIKE '%a%'
OR fx_profiles.department LIKE '%a%'
OR fx_profiles.website LIKE '%a%'
OR fx_profiles.country LIKE '%a%'
OR fx_profiles.city LIKE '%a%'
OR fx_profiles.address LIKE '%a%'
OR fx_profiles.zip_code LIKE '%a%'
OR fx_profiles.keywords LIKE '%a%' )
)
UNION (SELECT fx_publications.publication_id, fx_publications.title as matched_field, 'publication' as type
FROM fx_publications
WHERE ( publications.authors LIKE '%a%'
OR publications.year LIKE '%a%'
OR publications.title LIKE '%a%'
OR publications.reference LIKE '%a%' )
)
UNION (SELECT fx_projects.project_id, fx_projects.title as matched_field, 'project' as type
FROM fx_projects
WHERE ( projects.title LIKE '%a%'
OR projects.description LIKE '%a%' )
)
) AS u
ORDER BY id DESC
LIMIT 0, 20
Any help will be appreciated. 任何帮助将不胜感激。 PS: This is part of a code in my Codeigniter Model.
PS:这是我的Codeigniter模型代码的一部分。
This line doesn't make sense: 这行没有意义:
WHERE (fx_profiles.first_name, fx_profiles.last_name, fx_profiles.research_area LIKE '%a%'
You should change it to: 您应该将其更改为:
WHERE (fx_profiles.first_name LIKE '%a%' or
fx_profiles.last_name LIKE '%a%' or
fx_profiles.research_area LIKE '%a%'
. . .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.