Guest User

10.FullInfo

a guest
Oct 28th, 2019
193
6 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT IIF(CONCAT(e.FirstName, ' ', e.LastName) = '', 'None',  CONCAT(e.FirstName, ' ', e.LastName)) AS [Employee],
  2.        IIF(d.Name IS NULL, 'None', d.Name) AS [Department],
  3.        c.Name AS [Category],
  4.        r.Description,
  5.        FORMAT(r.OpenDate, 'dd.MM.yyyy') AS [OpenDate],
  6.        s.Label AS [STATUS],
  7.        u.Name AS [USER]
  8. FROM Reports AS r
  9. LEFT OUTER JOIN Employees AS e ON r.EmployeeId = e.Id
  10. LEFT OUTER JOIN Departments AS d ON e.DepartmentId = d.Id
  11. LEFT OUTER JOIN Categories AS c ON r.CategoryId = c.Id
  12. LEFT OUTER JOIN Users AS u ON r.UserId = u.Id
  13. LEFT OUTER JOIN STATUS AS s ON s.Id = r.StatusId
  14. ORDER BY e.FirstName DESC, e.LastName, d.Name, c.Name, r.Description, r.OpenDate, s.Id, u.Id
RAW Paste Data