gpt4 book ai didi

php - MySQL 查询 : right syntax to use for `SELECT users.(foo, bar)`

转载 作者:太空宇宙 更新时间:2023-11-03 10:28:09 26 4
gpt4 key购买 nike

这是MySQL代码。

SELECT users.(user_id, pic, first_name, last_name, username), 
comments.(id, user_id, date_created)
FROM users
INNER JOIN comments ON users.user_id = comments.user_id
WHERE comments.user_id = '$user_id'
GROUP BY comments.date_created

我收到以下错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(user_id, pic, first_name, last_name, username), comments.(id, user_id, date_created)' at line 1

最佳答案

尝试:

SELECT u.user_id, u.pic, u.first_name, u.last_name, u.username, c.id, c.user_id AS comment_user_id, c.date_created
FROM users u
INNER JOIN comments c ON u.user_id = c.user_id
WHERE c.user_id = '$user_id'
GROUP BY c.date_created

关于php - MySQL 查询 : right syntax to use for `SELECT users.(foo, bar)` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3210007/

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