SQL语句有什么问题?我收到一条消息,指出存在语法错误(缺少运算符)。从ASSIGNMENT TABLE我想要选择ASSN_TRANS_STATE_NUM ='1'的所有行。对于这些行中的每一行,我想从PROJECTS表中获取项目名称。我还想从TASKS表中获取每个任务名称。我确实让它早点工作(不确定我做了什么改变打破了它),但即使它确实有效也不正确。它报告了每个项目的每项任务,而不是仅仅向我提供项目特定的任务。
SELECT
TRANS.PROJ_UID,
PROJ.PROJ_NAME,
TRANS.TASK_UID,
TASKS.TASK_NAME,
TRANS.ASSN_TRANS_STATE_ENUM,
TRANS.ASSN_TRANS_APPROVER_RES_UID
FROM dbo_MSP_ASSIGNMENT_TRANSACTIONS TRANS
INNER JOIN dbo_MSP_PROJECTS PROJ ON PROJ.PROJ_UID = TRANS.PROJ_UID
INNER JOIN dbo_MSP_TASKS TASKS ON TASKS.TASK_UID = TRANS.TASK_UID
WHERE TRANS.ASSN_TRANS_STATE_ENUM = 1;
答案 0 :(得分:0)
这将是dbo。而不是dbo_。我想它应该有所帮助
SELECT
TRANS.PROJ_UID,
PROJ.PROJ_NAME,
TRANS.TASK_UID,
TASKS.TASK_NAME,
TRANS.ASSN_TRANS_STATE_ENUM,
TRANS.ASSN_TRANS_APPROVER_RES_UID
FROM dbo.MSP_ASSIGNMENT_TRANSACTIONS TRANS
INNER JOIN dbo.MSP_PROJECTS PROJ ON PROJ.PROJ_UID = TRANS.PROJ_UID
INNER JOIN dbo.MSP_TASKS TASKS ON TASKS.TASK_UID = TRANS.TASK_UID
WHERE TRANS.ASSN_TRANS_STATE_ENUM = 1;