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
Answer Posted / 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 |
Post New Answer View All Answers
what are the differences between binary and varbinary? : Sql dba
What is restrict in sql?
What is the maximum number of columns in sql table?
What are the advantages of pl sql?
How can you get sql*loader to commit only at the end of the load file? : aql loader
How many types of triggers are there in pl sql?
Which one is faster ienumerable or iqueryable?
How do you update f as m and m as f from the below table testtable?
Is trigger a stored procedure?
What do you understand by case manipulation functions?
What is left join in sql?
does sql support programming? : Sql dba
What is the command used to fetch the first 5 characters of a string?
What are sql constraints?
What are sql ddl commands?