Home » RDBMS Server » Server Administration » Crosstab query??
Crosstab query?? [message #370778] |
Sat, 05 February 2000 14:10 |
kat
Messages: 15 Registered: February 2000
|
Junior Member |
|
|
Hi, I am very newbie here. Can someone tell me if it's possible to create a crosstab query with Oracle SQL?? If not, is there anything similar? Please help, my project is due by the end of this week.
|
|
|
|
Re: Crosstab query?? [message #370785 is a reply to message #370778] |
Tue, 08 February 2000 04:36 |
Atavur Rahaman S.A
Messages: 23 Registered: January 2000
|
Junior Member |
|
|
Hello,
I think this will be O.K for ur Query....
SQL> Select work_order_no,decode(WorkTypeTable.work_typeID,1,estimated_cost,0) CARPENTER,decode(WorkTypeTable.work_typeID,2,estimated_cost,0) ELECTRICIAN, decode(WorkTypeTable.work_typeID,3,estimated_cost,0) PAINTER,
decode(WorkTypeTable.work_typeID,4,estimated_cost,0) PLUMBER from WorkOrderTable,WorkTypeTable
from WorkTypeTable,WorkOrderTable where WorkType.WorkTypeID=WorkOrderTable.workTypeID
Regards
Rehman
|
|
|
Re: Crosstab query?? [message #370786 is a reply to message #370778] |
Tue, 08 February 2000 04:36 |
Atavur Rahaman S.A
Messages: 23 Registered: January 2000
|
Junior Member |
|
|
Hello,
I think this will be O.K for ur Query....
SQL> Select work_order_no,decode(WorkTypeTable.work_typeID,1,estimated_cost,0) CARPENTER,decode(WorkTypeTable.work_typeID,2,estimated_cost,0) ELECTRICIAN, decode(WorkTypeTable.work_typeID,3,estimated_cost,0) PAINTER,
decode(WorkTypeTable.work_typeID,4,estimated_cost,0) PLUMBER from WorkOrderTable,WorkTypeTable
from WorkTypeTable,WorkOrderTable where WorkType.WorkTypeID=WorkOrderTable.workTypeID
Regards
Rehman
|
|
|
Re: Crosstab query?? [message #370790 is a reply to message #370778] |
Tue, 08 February 2000 16:02 |
kat
Messages: 15 Registered: February 2000
|
Junior Member |
|
|
Hi my lifesaver,
thank you so very much. That's exactly what I am looking for. Thank you thank you thank you........... (Cannot say enough) =^;^=
|
|
|
Re: Crosstab query?? [message #370807 is a reply to message #370778] |
Thu, 10 February 2000 07:11 |
kumaresan
Messages: 3 Registered: February 2000
|
Junior Member |
|
|
Hi Kat,
We can do the matrix report as mentioned below.
Let us take example of emp table
Select job,
sum(decode(deptno,10,sal)) dept10,
sum(decode(deptno,20,sal)) dept20,
sum(decode(deptno,30,sal)) dept30
from emp
group job;
Regards,
Kumar
|
|
|
|
Goto Forum:
Current Time: Sun Dec 22 04:56:56 CST 2024
|