Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How is a PL/SQL code compiled?

1240


Why do we use sqlite?

990


What is sql basics?

1046


How to create your own reports in sql developer?

1027


What is difference between pl and sql?

1068


What is difference between function and trigger?

1055


what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

1133


What are the operators used in select statements?

1059


what is the use of set statement in tsql? : Transact sql

1011


How do I upgrade sql?

1006


Can we rollback after truncate?

1035


Which software is used for pl sql programming?

993


Is primary key always clustered index?

1028


Why left join is used in sql?

984


How can we make an if statement within a select statement?

1018