TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Riddhi Valecha
444
3.3k
412.7k
Oracle - Sum in select query
Jun 24 2015 9:38 AM
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 !
Reply
Answers (
4
)
this.
How to add temporary column in Sql Server