SQL在日志中获取最新评论

时间:2017-05-12 13:06:28

标签: sql sql-server tsql

我正在尝试获取sql中日志的最新注释(注释)

这是我的查询及其返回的内容:

    SELECT        Project.SupportLogNote.SupportLogID_SupportLogID, Project.SupportLogNote.Note, CAST(Project.SupportLogNote.NoteDate AS Date) AS NoteDate, Project.SupportLogNote.ContactID_CreatorID, 
                         sop.bb_contacts.firstName + ' ' + sop.bb_contacts.lastName AS fullName, Project.SupportLogNote.clientId, Project.SupportLog.StatusID_StatusID
FROM            Project.SupportLogNote INNER JOIN
                         sop.bb_contacts ON Project.SupportLogNote.ContactID_CreatorID = sop.bb_contacts.id INNER JOIN
                         Project.SupportLog ON Project.SupportLogNote.SupportLogID_SupportLogID = Project.SupportLog.SupportLogID
WHERE        (Project.SupportLogNote.ContactID_CreatorID = 109)
ORDER BY Project.SupportLogNote.SupportLogID_SupportLogID DESC

enter image description here

我想从日志中获取最新的Note,因此只有1个SupportLogID和与该ID对应的最新注释。

感谢您的帮助。

0 个答案:

没有答案