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...

Hello All, Could any well write a query for the following
scenario.

Account(table name)
No Name Amount
1 ABCD 2000.00
2 DEFG -2000.00
3 GHIJ 3000.50
4 JKLM 4000.00
5 MNOP 6000.00

O/p Should be in this format
No Name Credit Debit
1 ABCD 2000.00 0
2 DEFG 0 -2000.00
3 GHIJ 3000.50
4 JKLM 0 -4000.00
5 MNOP 6000.00 o

could any one give appropriate query for this
Thnks in Advance
Suneel Reddy

Answer Posted / saravana sundar

select sno,name,decode(sign(amount),1,0,amount)debit,decode
(sign(amount),-1,0,amount)credit from account
/

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is 19 null in sql?

900


How do I start sql profiler?

943


What is the difference between microsoft sql and mysql?

921


Can we use delete in merge statement?

1002


How many sectors are in a partition?

1034


what is the difference between union and union all? : Sql dba

976


What is aggregate function in sql?

990


what does the t-sql command ident_incr does? : Transact sql

1014


What type of join is sql join?

925


what are dynamic queries in t-sql? : Transact sql

964


Explain aggregate functions are available there in sql?

943


What is data type in database?

935


What are the built in functions of sql?

983


how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba

1127


What is pessimistic concurrency control? : Transact sql

1027