gpt4 book ai didi

php - mysql PHP join - 语法问题

转载 作者:行者123 更新时间:2023-11-29 08:51:45 25 4
gpt4 key购买 nike

我正在尝试连接 3 个表,但我的查询不断出现错误。我不确定我做错了什么。我的语法一定是做错了什么,但我不太确定出了什么问题。

SELECT project_timecard_tasks.DateTime,
project_timecard_tasks.Total_Hours,
project_timecard_tasks.User_ID,
project_timecard_tasks.Task_ID,
project_timecard_tasks.Project_ID,
users.User_ID,
users.FirstName,
users.LastName,
tasks.id,
tasks.taskName

FROM project_timecard_tasks

JOIN project_timecard_tasks ON project_timecard_tasks.User_ID = users.User_ID
AND project_timecard_tasks.Task_ID = tasks.id

WHERE project_timecard_tasks.Project_ID = '$jobNumber'

最佳答案

您的 JOIN 语句有点不稳定。试试这个:

SELECT project_timecard_tasks.DateTime,
project_timecard_tasks.Total_Hours,
project_timecard_tasks.User_ID,
project_timecard_tasks.Task_ID,
project_timecard_tasks.Project_ID,
users.User_ID,
users.FirstName,
users.LastName,
tasks.id,
tasks.taskName

FROM project_timecard_tasks

JOIN users ON project_timecard_tasks.User_ID = users.User_ID
JOIN tasks ON project_timecard_tasks.Task_ID = tasks.id

WHERE project_timecard_tasks.Project_ID = '$jobNumber'

关于php - mysql PHP join - 语法问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10990517/

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