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 serial sql?
write a pl/sql function if enter a value=0 then output value=1 and vise verse with out using if and case statements.
What is percent sign in sql?
How do you go back in sql?
what is timestamp in mysql? : Sql dba
Could you please provide oca (oracle 10g) dumps for my certification ?
Is sql a programming?
Why sql query is slow?
How many types of triggers are there in pl sql?
What are the benefits of triggers?
what is the difference between a having clause and a where clause? : Sql dba
what is the difference between sql and t-sql? : Transact sql