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 is check constraint? : Sql dba
How sql query is executed?
What is indexes?
what is the difference difference between procedure and packages
2 Answers 3i Infotech, Oracle,
What does dml mean?
Does sqlite need a server?
i have some prob lem to tell me about my self in interview first round ...
explain advantages of myisam over innodb? : Sql dba
Can we declare a column having number data type and its scale is larger than pricesionex: column_name number(10,100),column_name numbaer(10,-84)
How to raise user-defined exception with custom sqlerrm ?
What is sql basics?
Explain clause in sql?
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)