Hi all...
I have a query with the following output -
select E.EmpCode,
(select count (D.id) from Dept D where D.Location = E.Location) as "A"),
(select count (D.id) from Add D where D.Location = E.Location) as "B"),
(select count (D.id) from Dept D where D.DeptName = E.DeptName) as "C")
from Employees E
| EmpCode | A | B | C | D=A+B-C |
| 100A | 2 | 4 | 7 | 2+4-7 = -1 |
| 101A | 3 | 5 | 7 | 3+5-7 = 1 |
How to add one more column in this query and get the result - Row-wise total in "D" Column ??
Please guide and Help !
Thank a ton !
Manoj BhoirRank #599 · 4K reputationPosted Jun 24, 2015, 9:21 PM EDT
Guest UserRank #816 · 2.8K reputationPosted Jun 24, 2015, 5:53 AM EDT
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Jun 24, 2015, 7:01 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Jul 29, 2015, 11:19 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts