mysql-error-1241

SQL query returning “Operand should contain 1 column(s)”

守給你的承諾、 提交于 2020-01-11 12:48:27
问题 I'm currently working on a query which will have all rows from one table, but only limited information from the other. I've tried working with this query: SELECT `t`.`uid`, `t`.`cid`, `t`.`id` FROM `tracking` as `t` JOIN (SELECT DISTINCT(`p`.`id`, `p`.`firstname`, `p`.`lastname`, `p`.`company`) FROM `publishers` as `p`) as `p` ON `p`.id = `t`.uid However, I get the error as in the topic heading. Can anyone see what I'm doing wrong here? Edit: Structure on tracking: id int(11) primary ai, cid

MySQL Error “Operand should contain 1 column” [duplicate]

早过忘川 提交于 2019-12-29 06:50:07
问题 This question already has answers here : Operand Should Contain 1 Column - MySQL NOT IN (3 answers) Closed 5 years ago . I could find a lot of similar questions but no real solution for my problem. My SQL query: UPDATE ADRESSEN SET EMAIL = 0 WHERE ID = (SELECT ID, COUNT(ID) AS COUNTER FROM EIGENSCHAFTEN WHERE Kategorie = "BOUNCE" GROUP BY ID HAVING COUNTER = 1) The error code I receive is #1241 - Operand should contain 1 column(s) If I just use the query in the parentheses it works and the

Error #1241 - Operand should contain 1 column(s) in Mysql [duplicate]

人走茶凉 提交于 2019-12-23 20:13:20
问题 This question already has answers here : Operand Should Contain 1 Column - MySQL NOT IN (3 answers) Closed 5 years ago . I just try following query: SELECT *, ( SELECT count(*) FROM users where users.email=calls.email ) as ureg, ( SELECT sum(qty) FROM product where product.owner in (SELECT * from users where users.email=calls.email) ) as pop FROM calls order by calls.data desc LIMIT 0,20 but I get following error : #1241 - Operand should contain 1 column(s) How should I fix my query? Edit: by

MySQL - Operand should contain 1 column(s)

 ̄綄美尐妖づ 提交于 2019-12-17 02:29:33
问题 While working on a system I'm creating, I attempted to use the following query in my project: SELECT topics.id, topics.name, topics.post_count, topics.view_count, COUNT( posts.solved_post ) AS solved_post, (SELECT users.username AS posted_by, users.id AS posted_by_id FROM users WHERE users.id = posts.posted_by) FROM topics LEFT OUTER JOIN posts ON posts.topic_id = topics.id WHERE topics.cat_id = :cat GROUP BY topics.id ":cat" is bound by my PHP code as I'm using PDO. 2 is a valid value for "

#1241 - Operand should contain 1 column(s)

喜欢而已 提交于 2019-12-02 12:35:13
问题 In the following query am trying to get one image per category SELECT l.* FROM ( SELECT id AS category_id, COALESCE( ( SELECT * FROM images li WHERE li.category_id = dlo.id ORDER BY li.save_status DESC, li.category_id DESC, li.id DESC LIMIT 1 ), 0) AS mid FROM cats_imgs dlo where id='1' ) lo JOIN images l ON l.save_status = '3' AND l.category_id >= lo.category_id AND l.category_id <= lo.category_id AND l.id >= lo.mid but keep getting the following error : #1241 - Operand should contain 1

SQL query returning “Operand should contain 1 column(s)”

北城余情 提交于 2019-12-02 08:17:12
I'm currently working on a query which will have all rows from one table, but only limited information from the other. I've tried working with this query: SELECT `t`.`uid`, `t`.`cid`, `t`.`id` FROM `tracking` as `t` JOIN (SELECT DISTINCT(`p`.`id`, `p`.`firstname`, `p`.`lastname`, `p`.`company`) FROM `publishers` as `p`) as `p` ON `p`.id = `t`.uid However, I get the error as in the topic heading. Can anyone see what I'm doing wrong here? Edit: Structure on tracking: id int(11) primary ai, cid int(11), uid int(11). Structure on publishers: id int(11) primary ai, firstname varcher(60), lastname

#1241 - Operand should contain 1 column(s)

独自空忆成欢 提交于 2019-12-02 04:48:54
In the following query am trying to get one image per category SELECT l.* FROM ( SELECT id AS category_id, COALESCE( ( SELECT * FROM images li WHERE li.category_id = dlo.id ORDER BY li.save_status DESC, li.category_id DESC, li.id DESC LIMIT 1 ), 0) AS mid FROM cats_imgs dlo where id='1' ) lo JOIN images l ON l.save_status = '3' AND l.category_id >= lo.category_id AND l.category_id <= lo.category_id AND l.id >= lo.mid but keep getting the following error : #1241 - Operand should contain 1 column(s) Any ideas ? replace * with a single column for images li RexBarker I had a similar problem. Your

operand should contain 1 columns [duplicate]

霸气de小男生 提交于 2019-12-02 03:59:07
问题 This question already has answers here : Operand Should Contain 1 Column - MySQL NOT IN (2 answers) Closed 5 years ago . SELECT topic_id FROM phpbb_topics AS t WHERE t.topic_id IN ( SELECT p.topic_id, COUNT(p.post_id) AS total_posts FROM phpbb_posts AS p WHERE p.poster_id = 61640 GROUP BY p.topic_id HAVING t.topic_replies_real = total_posts - 1 ); That query gets me the following error: Error Code: 1241. Operand should contain 1 column(s) Any ideas? 回答1: You shouldn't include COUNT(p.post_id)

operand should contain 1 columns [duplicate]

ⅰ亾dé卋堺 提交于 2019-12-01 23:19:59
This question already has an answer here: Operand Should Contain 1 Column - MySQL NOT IN 2 answers SELECT topic_id FROM phpbb_topics AS t WHERE t.topic_id IN ( SELECT p.topic_id, COUNT(p.post_id) AS total_posts FROM phpbb_posts AS p WHERE p.poster_id = 61640 GROUP BY p.topic_id HAVING t.topic_replies_real = total_posts - 1 ); That query gets me the following error: Error Code: 1241. Operand should contain 1 column(s) Any ideas? You shouldn't include COUNT(p.post_id) AS total_posts in SELECT list in your subquery. Just SELECT topic_id FROM phpbb_topics AS t WHERE t.topic_id IN ( SELECT p.topic

Is it possible for a subquery to return two values?

為{幸葍}努か 提交于 2019-12-01 17:13:06
Is it possible for a subquery to return two values onto the outer query? Such as: SELECT 1, (SELECT COUNT(*), MAX(*) FROM test_table WHERE test=123) FROM another_table Or is there a better way to do this? If you use the subquery in the FROM clause rather than the field list, then you can treat the output as a table and refer to the separate columns. You are just selecting numbers as results so couldn't you just do: SELECT 1, COUNT(*), MAX(*) FROM test_table WHERE test=123 Not possible mysql> select 1, (select 2, 3) from dual; ERROR 1241 (21000): Operand should contain 1 column(s) If you are