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 'mysql' command line options? : Sql dba
What does count (*) do in sql?
What is nested table in pl sql?
How is pl sql different from sql?
What are basic techniques of indexing?
What are the types of keys?
what is the use of set statement in tsql? : Transact sql
Are ddl triggers fired for ddl statements within a pl/sql code executed using the dbms.sql package?
i have 2 table table one 4 columns respective values a1 7,a2 6,a3 8 ,a4 12 & table two 4 colums respective values a1 7,a2 6,a3 8,a4 15.if table one & table two 3 colums same then 4th column values 1)Qes diff >5 then print 5 * diff value 2)Que diff <5 print 5
What is the difference between delete and truncate statement in sql?
what is subquery? : Sql dba
does sql support programming? : Sql dba
What is the use of pl/sql table?
Is sql a case sensitive language?
What is the usage of the distinct keyword?