您好我正在尝试执行以下查询,但没有运气:
SELECT AA.Id, AA.ObjId, AA.NsId, AA.statusId, AA.LCID, AA.Title, AA.MessageBody_ClearText, AA.MessageBody_HTMLText,
AA.File1, AA.File2, AA.File3, AA.Status, AA.name, AA.createdate, AA.updatedate, AA.boneid, AA.main, AA.Sort,
BB.ID AS Expr1, BB.MainIDNum, BB.MessageID, BB.Message1, BB.Message2, BB.Message3, BB.MessageDate,
BB.AttachmentGUID1, BB.AttachmentGUID2, CC.MessageID AS Expr2, CC.Identification, CC.Viewed, CC.Deleted, CC.Id AS Expr3,
AA.FileName1, AA.FileName2, AA.FileName3
FROM dbo.gnvw_ObjectsBones AS AA INNER JOIN
--- XXX.dbo.MESSAGES AS BB ON BB.MessageID = AA.ObjId LEFT OUTER JOIN ---
dbo.PersonalMessages AS CC ON CC.MessageID = BB.MessageID AND CC.Identification = BB.MainIDNum
标记的行需要更改为函数调用,我有一个名为“GetMessages”的函数,它接受一个int“输入”,它必须是那个:“CC.Identification”,所以我试图替换它变成这样:
SELECT AA.Id, AA.ObjId, AA.NsId, AA.statusId, AA.LCID, AA.Title, AA.MessageBody_ClearText, AA.MessageBody_HTMLText,
AA.File1, AA.File2, AA.File3, AA.Status, AA.name, AA.createdate, AA.updatedate, AA.boneid, AA.main, AA.Sort,
BB.ID AS Expr1, BB.MainIDNum, BB.MessageID, BB.Message1, BB.Message2, BB.Message3, BB.MessageDate,
BB.AttachmentGUID1, BB.AttachmentGUID2, CC.MessageID AS Expr2, CC.Identification, CC.Viewed, CC.Deleted, CC.Id AS Expr3,
AA.FileName1, AA.FileName2, AA.FileName3
FROM dbo.gnvw_Data_PersonalMessages_ObjectsBones AS AA INNER JOIN
XXX.dbo.GetMessages(CC.Identification) AS BB ON BB.MessageID = AA.ObjId LEFT OUTER JOIN
dbo.PersonalMessages AS CC ON CC.MessageID = BB.MessageID AND CC.Identification = BB.MainIDNum
我也尝试了其他解决方案,但都没有奏效,这里有人看到问题了吗?这是我从运行该“解决方案”中得到的错误:
'无法绑定多部分标识符“CC.Identification”。'
和,
'无效的列名'ID'。' SQL 不是我的强项,我很乐意听到任何解决方案,希望我解释正确。