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
Answers were Sorted based on User's Feedback
Answer / 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 |
What are Lexical Parameters.How They are used in Reports 6i
I m giving Source, Destination and Age. Write a procedure or function, it will give to u this source to destination tickets are available or not, if available then check this person is senior citizen or not,if this person is senior citizen then give some discount. PLZ give this answer...... Thanks advance.....
Define select, insert, create, delete, update, drop keywords
How do you rank data in sql?
What are the differences between Database Trigger and Integrity constraints ?
What is the order of sql select?
Write a pl/sql script to display the following series of numbers: 99,96,93……9,6,3?
what is meant by forward declaration in functions?
How to set up sql*plus output format in oracle?
What is the purpose of design view?
what is explain plan?, given an example...
Query for second maximum salary in each in each department
15 Answers DST Global Solutions, TCS,
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)