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
Hi
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


Responses

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

Up
0
Down
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.
https://stackoverflow.com/questions/4463374/trying-to-join-two-tables-and-get-the-count-of-how-many-comments-were-made-about

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