i have one table with accounts and amounts as
colums.accounts with columns c and d. and amounts with
values 1000,2000,3000 for c and 4000,5000,8000 for d.i need
to find the sum of these accounts c and d individually
and find the differences between their sum using one select
statement.
Answer Posted / umesh naik
select a.amt1 c_sum ,b.amt2 d_sum
, a.amt1 - b.amt2 cd_diffrence
from
(select sum(amount) amt1 from one_table where account='c')
a,
(select sum(amount) amt2 from one_table where account='c') b
select (select sum(a.amount) from one a where
a.account='d')-(select sum(b.amount) from one b where
b.account='c') from dual;
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Can function return multiple values in sql?
what are date and time intervals? : Sql dba
What does over partition by mean in sql?
What is the plv (pl/vision) package offers?
Define sql delete statement.
What is mutating table error?
What is the difference between truncate and drop statements?
Can we delete column in sql?
What is the difference between delete and truncate commands?
How does a self join work?
how to calculate expressions with sql statements? : Sql dba
What is recursive stored procedure?
What is a string data type in sql?
What do you think about pl/sql?
How many postgresql users are there, worldwide?