Inner Join With Count And Case

Here in this blog, I have discussed about inner join with count and case tutorial.

In this code I am showing how to count records in more than one table and how to use case for printing message.
  1. select COUNT( * ) as 'Num of Role', Types = (    
  2.     case when UserRole.Id = 1 then 'Created By Admin'    
  3.     when UserRole.Id = 8 then 'Created By Creator'    
  4.     endfrom Model inner join dbo.[Useron Model.UserId = [User].Id    
  5. inner join UserRole on dbo.[User].UserRoleId = dbo.[UserRole].Id Group By UserRole.Id    
Output

Up Next
Ebook Download
View all
Learn
View all