Home » RDBMS Server » Server Administration » Crosstab query??
Crosstab query?? [message #370778] Sat, 05 February 2000 14:10 Go to next message
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 #370780 is a reply to message #370778] Mon, 07 February 2000 01:35 Go to previous messageGo to next message
Atavur Rahaman S.A
Messages: 23
Registered: January 2000
Junior Member
Hello,
Could you pls. give an example of what you are expecting; I mean what type of data that you want.

Thanks in Advance
Atavur Rahaman
Re: Crosstab query?? [message #370785 is a reply to message #370778] Tue, 08 February 2000 04:36 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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
Re: Crosstab query?? [message #370817 is a reply to message #370778] Thu, 10 February 2000 19:30 Go to previous message
Nell
Messages: 7
Registered: February 2000
Junior Member
Thanks, I will try that!!!!!!!!
Previous Topic: How do I query tables from 2 databases?
Next Topic: Returning 2 values with Max function (New One)
Goto Forum:
  


Current Time: Sun Dec 22 04:56:56 CST 2024