SHARE
TWEET

--Task 7

a guest Jul 14th, 2015 200 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Task 7
  2. Find all user in games with information about them. Display the game name, game type, username, level, cash and character name. Sort the result by level in descending order, then by username and game in alphabetical order. Submit for evaluation the result text comma separated with headers.
  3.  
  4. select
  5.         g.Name as Game,
  6.         gt.Name as [Game Type],
  7.         u.Username,
  8.         ug.Level as [Level],
  9.         ug.Cash,
  10.         c.Name as [Character]
  11. from Games g
  12. join UsersGames ug
  13. on g.Id = ug.GameId
  14. join Users u
  15. on ug.UserId = u.Id
  16. join GameTypes gt
  17. on g.GameTypeId = gt.Id
  18.  join Characters c
  19. on ug.CharacterId = c.Id
  20. order by ug.[Level] desc, u.Username asc, g.Name asc
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top