我正在尝试执行此查询
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
如何从该查询中获取多行?
答案 0 :(得分:0)
我认为这些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`
谢谢。