Access to SQL query

  • Hi everyone. Can any one suggest how I could get this query to run under SQL server?

     

    SELECT tblDiaryLog.Id, tblDiaryLog.Ticket_Id, tblDiaryLog.LogTime, IIf(IsNull([name]),[admin],[name]) AS [User], tblDiaryLog.Comment

    FROM tblDiaryLog LEFT JOIN tblAdmin ON tblDiaryLog.Admin_Id = tblAdmin.Id

    ORDER BY tblDiaryLog.LogTime DESC;

    many thanks for any advice.

  • Try this

    SELECT tblDiaryLog.Id, tblDiaryLog.Ticket_Id, tblDiaryLog.LogTime,

    COALESCE([name], [admin]) AS [User], tblDiaryLog.Comment

    FROM tblDiaryLog LEFT JOIN tblAdmin ON tblDiaryLog.Admin_Id = tblAdmin.Id

    ORDER BY tblDiaryLog.LogTime DESC



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • AJ , many thanks for reply. Works fine , thank you.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply