Questions tagged «mysql-error-1241»

9
MySQL-操作数应包含1列
在正在创建的系统上工作时,我尝试在项目中使用以下查询: 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 当我使用PDO时,“:cat”受我的PHP代码约束。2是“:cat”的有效值。 该查询虽然给我一个错误:“#1241-操作数应包含1列” 让我感到困扰的是,我认为该查询不会有问题。选择列,然后从另一个表中选择另外两个,然后从那里继续。我只是不知道是什么问题。 有没有简单的解决方法,或者是写查询的另一种方法?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.