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 |
How can you tell the difference between an index and a view?
what is normalization? : Sql dba
how many triggers are allowed in mysql table? : Sql dba
Explain about various levels of constraint.
Why is a primary key important?
What is difference between pls_integer and integer?
How do I remove sql plus from windows 10?
Types of indexes. What is the default key created when a primary key is created in a table ?
Why truncate is used in sql?
How to disable a trigger name update_salary?
what is the difference between implicit conversions and explicit conversions?
What is sql*loader?