Re: Decode question

From: bung ho <bung_ho_at_hotmail.com>
Date: 26 Jun 2003 15:21:29 -0700
Message-ID: <567a1b1.0306261421.55e07e2b_at_posting.google.com>


"Julia Sats" <julia_sats_at_sympatico.ca> wrote in message news:<2FrKa.4083$iM4.605358_at_news20.bellglobal.com>...
> does exist any chance to do in SQL , without using PL/SQL code like it:
>
> select project_type,
> decode (project_type,
> 1, select count(*) from t1,
> 2, select count(*) from t2,
> 3, select count(*) from t3,
> 0) count_prj
> from projects
>
> Thanks

sure. you almost had it. you just need some parens --

select project_type,
decode (project_type,

1, (select count(*) from t1),
2, (select count(*) from t2),
3, (select count(*) from t3),

0) count_prj
from projects Received on Fri Jun 27 2003 - 00:21:29 CEST

Original text of this message