gpt4 book ai didi

MySQL JOIN 没有返回值

转载 作者:行者123 更新时间:2023-11-30 23:10:23 25 4
gpt4 key购买 nike

我有 mysql 查询,它似乎可以工作,但不会从 payments 表返回值。我做错了什么?

SELECT members.id, members.name, members.lastname 
FROM members
JOIN (SELECT payments.id, payments.user_id, payments.begin_date,
MAX(payments.finish_date) AS finish_date, payments.price
FROM payments
GROUP BY payments.user_id)
AS payments
WHERE members.id=payments.user_id AND payments.finish_date>=CURDATE()
ORDER BY payments.finish_date ASC, payments.id ASC`

我使用:

echo stripslashes($wiersz['begin_date']);

返回行数据。

最佳答案

您可能需要注意您没有在主查询中选择 begin_date 字段:

SELECT members.id, members.name, members.lastname FROM ...

尝试使用

SELECT members.id, members.name, members.lastname, begin_date FROM ...

安德烈

关于MySQL JOIN 没有返回值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20049677/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com