MySQL 错误:子查询返回超过 1 行
子查询返回超过 1 行
出现错误:#1242 -执行此操作时
SELECT `Index` , `FundName` ,Count(*),
(SELECT COALESCE(sum(b.PricePerWeek),0)
FROM tbl_FundSubscriptions
WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= SubscribeDt
GROUP BY FundIDSend)
FROM tbl_FundSubscriptions b, tbl_FundStatic a
WHERE a.FundID = b.FundIDSend
AND FundIDSend IN
(SELECT FundID
FROM tbl_FundStatic
WHERE UserID = '14')
GROUP BY a.FundName,a.Index
可能出了什么问题?
谢谢
Getting error : #1242 - Subquery returns more than 1 row
while executing this
SELECT `Index` , `FundName` ,Count(*),
(SELECT COALESCE(sum(b.PricePerWeek),0)
FROM tbl_FundSubscriptions
WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= SubscribeDt
GROUP BY FundIDSend)
FROM tbl_FundSubscriptions b, tbl_FundStatic a
WHERE a.FundID = b.FundIDSend
AND FundIDSend IN
(SELECT FundID
FROM tbl_FundStatic
WHERE UserID = '14')
GROUP BY a.FundName,a.Index
What could be wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是您要查找的查询吗?不知道您的表结构,我们永远不会知道,但这会执行您的查询似乎已缩进的操作。 (这有什么意义吗?)
Is this the query you're looking for? Not knowing your table structure, we'll never know, but this does what your query appears to have been indented to do. (Does that make any sense at all?)
您的子查询返回的行数超过 1 行。
您可以将子查询
LIMIT
到一行,或者将其与另一个表LEFT JOIN
。Your subquery is returning more then 1 row.
Either you
LIMIT
the subquery to one row or youLEFT JOIN
it with the other table.