Advertisement
ulivegenov

/* 10. Full Info */

Oct 20th, 2019
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. SELECT ISNULL(NULLIF(CONCAT(e.FirstName, ' ', e.LastName) , ' '), 'None') AS Employee,
  2. ISNULL(d.[Name], 'None') AS Department,
  3. c.[Name] AS Category,
  4. r.[Description],
  5. FORMAT(r.OpenDate, 'dd.MM.yyyy') AS OpenDate,
  6. s.[Label],
  7. u.[Name]
  8. FROM Reports AS r
  9. LEFT JOIN Employees AS e ON e.Id = r.EmployeeId
  10. LEFT JOIN Departments AS d ON d.Id = e.DepartmentId
  11. JOIN Categories AS c ON c.Id = r.CategoryId
  12. JOIN [Status] AS s ON s.Id = r.StatusId
  13. JOIN Users AS u ON u.Id = r.UserId
  14. ORDER BY e.FirstName DESC, e.LastName DESC, Department, Category, r.[Description], r.OpenDate, s.[Label], u.[Name]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement