How to perform for this Sql Server Query

Posted by Jayakumars under C# on 6/2/2017 | Points: 10 | Views : 201 | Status : [Member] [MVP] | Replies : 1
In advertisement company , how many people apply particular advertisement type particular state how will perform for this query

I need output this

Advertisment State Applymember
Hindu Paper Tamilnadu count here
Walkin Kerela
News Andhra
Friends Karnataka

here how many members in tamilnadu for
advertisement hindu paper,walkin, news ,friends individual count in every state
separately count i mention below query

create table advlist
aid int primary key identity(1,1),
aname nvarchar(100)

insert into advlist values ('Hindu'),('Walkin'),('News'),('Friends')

create table advstate
stid int primary key identity(1,1),
stname nvarchar(100)

insert into advstate values ('Tamilnadu'),('Kerela'),('Andhra'),('Karnataka')

create table advapply
apid int primary key identity(1,1),
apname nvarchar(100),
apmemberid int,
aid int
insert into advapply values ('John-A',1,1),('Rufals-A',2,1),('Watson-A',1,2),('morries-A',1,3)

create table advpersonal
apeid int primary key identity(1,1),
apemember nvarchar(50),
stid int

insert into advpersonal values ('John',1),('Rufals',2),('Watson',1),('morries',1)

Mark as Answer if its helpful to you


Posted by: Jitendrasoft09 on: 6/10/2017 [Member] [MVP] Starter | Points: 25

You join the all tables with group by clause in your column which want to count. Similar link is shared. Just try it now. Hope it helps you.

Jitendra Kumar
If my post helps you, plz mark as an answer.

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response