Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Query help!!
"Scott" <sivaraman55_at_gmail.com> schrieb im Newsbeitrag
news:1130209811.197875.235310_at_o13g2000cwo.googlegroups.com...
> Thank you. But in my example colMachinery and ColInventory are not used
> at all. But it still avialable in the table. Why should we add them in
> the query? Please explain.
>
> sum(decode(colst, 'A', colMachinery + colInventory)) "Total with Status
> A",
>
Sorry, I didn't fully understand your business logic.
But it isn't very difficult to change, isn't it ?
select coldate,
sum(decode(colst, 'A', 1)) "Total with Status A",
sum(decode(colst, 'B', 1)) "Total with Status B",
sum(decode(colst, 'C', 1)) "Total with Status C",
sum(decode(colst, 'D', 1)) "Total with Status D",
sum(decode(coltype, 'W', 1)) "Total of Type W",
sum(decode(coltype, 'X', 1)) "Total of Type X",
sum(decode(coltype, 'Y', 1)) "Total of Type Y",
sum(decode(coltype, 'Z', 1)) "Total of Type Z"
from scott.table1 t1, scott.table2 t2
where t1.colid = t2.colid
group by coldate
Regards
Dmytro Dekhtyaryuk Received on Tue Oct 25 2005 - 03:08:35 CDT
![]() |
![]() |