Php 在MySql中从子查询中获取多行

Php 在MySql中从子查询中获取多行,php,mysql,Php,Mysql,我正在尝试执行此查询 SELECT R1.`report_date`,(SELECT R2.`report_id` FROM `reports` AS R2 WHERE R2.`report_date` = R1.`report_date`) AS DATA FROM `reports` AS R1 GROUP BY R1.`report_date` 我得到了这个错误 MySQL said: #1242 - Subquery returns more than 1 row 如何从该查询

我正在尝试执行此查询

SELECT R1.`report_date`,(SELECT R2.`report_id` FROM `reports` AS R2 WHERE R2.`report_date` = R1.`report_date`) AS DATA FROM `reports` AS R1 GROUP BY R1.`report_date`
我得到了这个错误

MySQL said: 

#1242 - Subquery returns more than 1 row 

如何从该查询中获取多行???

我认为这些SQL对您很有用

SELECT R1.`report_date`,R2.`report_id` AS DATA
FROM `reports` AS R1 ,`reports` AS R2
WHERE R2.`report_date` = R1.`report_date`
GROUP BY R1.`report_date`
你能试试这些SQL吗

 SELECT R1.`report_date`,R2.`report_id` AS DATA
    FROM `reports` AS R1 ,`reports` AS R2
    WHERE R2.`report_date` = R1.`report_date`
    GROUP BY R2.`report_id`, R1.`report_date`

谢谢。

如果您需要多个值,您可以从子查询中获取单个值,然后它应该是
concat
,或者我们可以说用逗号分隔,如果您需要多个值,那么您可以使用
join
,或者对于单个值,将子查询值限制为1Thanks@Uchiha。如何使用JOIN获取多个值??实际上,我需要获取多个值。将预期的输出与表模式一起发布。我更新了我的答案。你能试试SQL吗?谢谢@Venkatesh Panabaka。您的查询检索单个值,但我想通过此查询检索多个值。谢谢@Venkatesh Panabaka。实际上,我想获取日期方面的结果。谢谢