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


SubashPosted Jul 3, 2016, 12:05 AM EDT
Nice
kalu singh raoPosted Jul 1, 2016, 11:14 AM EDT
Nice...
Gagan SharmaPosted Jun 30, 2016, 3:57 AM EDT
NIce