Advertisement
Guest User

Untitled

a guest
Jul 9th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. use Ads
  2. select lower(anu.Name) as UserName, count(anu.Name) AdsCount,
  3. case when anr.Name = 'Administrator' then 'yes'
  4. else 'no'
  5. end IsAdministrator
  6. from Ads a
  7. left join AspNetUsers anu ON a.OwnerId = anu.Id
  8. left join AspNetUserRoles anur ON anu.id = anur.UserId
  9. left join AspNetRoles anr ON anur.RoleId = anr.Id
  10. group by anu.Name, anr.Name
  11. order by UserName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement