Author: dibyendumandal11111
Subject: Join of more than one table
Posted: Mon Feb 13, 2017 11:36 pm (GMT 5.5)
Hi, Need a help-
I have 4 tables tableA, TableB, TableC and TableD
Requirement is like-
Query1:
Select TableA.Col1,Sum(TableC.col2) As Sum1
From TableA
Inner join TableB
on TableA.Colx = TableB.ColY
Inner join TableC
on TableB.Colx = TableC.ColY
group by TableA.Col1
Query2:
Select TableA.Col1,Sum(TableC.col2) Sum2
From TableA
Inner join TableB
on TableA.Colx = TableB.ColY
Inner join TableC
on TableB.Colx = TableC.ColY
Inner join TableD
on TableC.Colx = TableD.ColY
group by TableA.Col1
Now with this 2 query I want a result set having columns TableA.Col1,Sum1,Sum2. How can I combine them in a single query.
Subject: Join of more than one table
Posted: Mon Feb 13, 2017 11:36 pm (GMT 5.5)
Hi, Need a help-
I have 4 tables tableA, TableB, TableC and TableD
Requirement is like-
Query1:
Select TableA.Col1,Sum(TableC.col2) As Sum1
From TableA
Inner join TableB
on TableA.Colx = TableB.ColY
Inner join TableC
on TableB.Colx = TableC.ColY
group by TableA.Col1
Query2:
Select TableA.Col1,Sum(TableC.col2) Sum2
From TableA
Inner join TableB
on TableA.Colx = TableB.ColY
Inner join TableC
on TableB.Colx = TableC.ColY
Inner join TableD
on TableC.Colx = TableD.ColY
group by TableA.Col1
Now with this 2 query I want a result set having columns TableA.Col1,Sum1,Sum2. How can I combine them in a single query.