-
problem with a query
Hi,
I've this table:
ID AREA TYPE CATEGORY
01 20 OFFICE SPACE
01 30 OFFICE SPACE
01 50 ARCHIVES SPACE
02 10 MEETING SPACE
02 10 MEETING SPACE
02 100 ARCHIVES SPACE
03 20 SERVICE PLAN
03 20 MEETING SPACE
03 80 ARCHIVES SPACE
I'd like to create a query to get this output:
ID OFFICE SERVICE SPACE PLAN ARCHIVES MEETING
01 50 0 100 0 0 0
02 0 0 110 10 100 20
03 0 20 100 20 80 20
50 is sum(area) of ID=01 FOR TYPE=OFFICE.............
This is a crosstab query, I don't know if Oracle Can create a crosstab query, I hope so.
Could you help me??
Thanks
Raf
-
Code:
select id, type, sum(area)
from table
grou by id, type;
Sanjay G.
Oracle Certified Professional 8i, 9i.
"The degree of normality in a database is inversely proportional to that of its DBA"
-
sorry, but this query has id, type, area columns.
I want this columns:
id, OFFICE SERVICE SPACE PLAN ARCHIVES MEETING
Thanks
-
search the forum for "crosstab" and "pivot"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|