C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Inner Join With Count And Case
WhatsApp
Gagan Gautam
9y
8.3
k
0
4
25
Blog
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.
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
Output
People also reading
Membership not found