Sql query Error: Operand should contain 1 column(s) in rails
Posted
by dombesz
on Stack Overflow
See other posts from Stack Overflow
or by dombesz
Published on 2010-03-12T17:38:48Z
Indexed on
2010/03/12
17:47 UTC
Read the original article
Hit count: 293
Hi everyone,
SELECT * FROM jobs
WHERE (SELECT DISTINCT jobs.* FROM jobs, job_requests WHERE (jobs.user_id = 1) OR (job_requests.user_id = 1 AND job_requests.job_id = jobs.id))
This sql gives me Mysql::Error: Operand should contain 1 column(s). If i execute the select from the where clause it works SELECT DISTINCT jobs.* FROM jobs, job_requests WHERE (jobs.user_id = 1) OR (job_requests.user_id = 1 AND job_requests.job_id = jobs.id)
Could somebody explain me why? This query is generated by rails activerecord so the main select is needed.
© Stack Overflow or respective owner