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 do you declare a constant?
How to return more than one value from a function?
What is java sql driver?
how to concatenate two character strings? : Sql dba
what is a foreign key ? : Sql dba
What is database white box testing and black box testing?
What is difference between sql function and stored procedure?
We have a CURSOR then we need BULK COLLECT?
How many joins can you have in sql?
Does sql*plus also have a pl/sql engine?
What is error ora-01000: maximum open cursors exceeded
What is the best partition size for windows 10?