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

Answer Posted / vijay sultampur

Select No No,Name Name,Decode(Amount,Abs(Amount),Amount,0)
Credit, Decode(Amount,Abs(Amount),0,Amount) Debit
From Account;

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the advantages of mysql in comparison to oracle? : Sql dba

1005


what is the difference between where clause and having clause? : Sql dba

1002


Can a view be mutating? If yes, then how?

1028


What are all different types of collation sensitivity?

1035


Is sql a backend language?

1100


Does sql*plus also have a pl/sql engine?

1082


What are the sql aggregate functions?

1136


What are the ddl commands?

1013


What are user defined functions?

1024


what are the differences among rownum, rank and dense_rank? : Sql dba

1040


What is embedded sql in db2?

1022


what is the command used to fetch first 5 characters of the string? : Sql dba

1640


what are the nonstandard string types? : Sql dba

1144


How is pl sql different from sql?

1094


What is a database? Explain

1116