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

table having two columns - entity,zone
enity zone
pen east
pen west
pen north
pen south
pen east
pencil east
pencil east
pencil west

I want the output as :
entity east west north south
pen 2 1 1 1
pencil 2 1 0 0

Answer Posted / aswini mohanty

select entity,sum(decode(zone,'east',1,0)) east,
sum(decode(zone,'west',1,0)) west,
sum(decode(zone,'north',1,0))north,
sum(decode(zone,'south',1,0))south
from t group by entity;

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the 'mysql' command line options? : Sql dba

1072


What does count (*) do in sql?

1010


What is nested table in pl sql?

1070


How is pl sql different from sql?

1086


What are basic techniques of indexing?

1384


What are the types of keys?

996


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

1011


Are ddl triggers fired for ddl statements within a pl/sql code executed using the dbms.sql package?

1089


i have 2 table table one 4 columns respective values a1 7,a2 6,a3 8 ,a4 12 & table two 4 colums respective values a1 7,a2 6,a3 8,a4 15.if table one & table two 3 colums same then 4th column values 1)Qes diff >5 then print 5 * diff value 2)Que diff <5 print 5

4023


What is the difference between delete and truncate statement in sql?

1069


what is subquery? : Sql dba

1132


does sql support programming? : Sql dba

1041


What is the use of pl/sql table?

1066


Is sql a case sensitive language?

942


What is the usage of the distinct keyword?

1220