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 / mkumar.it

select no, name,
case amount/abs(amount) when 1 then amount else 0 end credit,
case amount/abs(amount) when -1 then amount else 0 end Debit
from account

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to fetch common records from two tables? : Sql dba

1155


What is the difference between functions, procedures, and packages in pl/sql?

1024


Explain some predefined exceptions.

1019


What are the different types of joins in sql?

1733


What are the types of subqueries?

1048


Is pl sql useful?

967


What are the differences between implicit and explicit cursors?

1049


what are the types of subquery? : Sql dba

1088


What do you understand by exception handling in pl/sql?

1012


What is gpt format?

929


when MSQL8.0 is in market

2064


How does join work in sql?

996


describe transaction-safe table types in mysql : sql dba

987


Why we use cross join?

938


How long it takes to learn pl sql?

996