Re: SELECT in problem
From: jefftyzzer <jefftyzzer_at_sbcglobal.net>
Date: Thu, 4 Mar 2010 10:50:52 -0800 (PST)
Message-ID: <f3e774ae-3a47-4946-a5bd-0493e38401d1_at_q21g2000yqm.googlegroups.com>
> Uzytkownik "jefftyzzer" <jefftyz..._at_sbcglobal.net> napisal w wiadomoscinews:07c710d1-5277-4e8f-971f-4d5dfb7764aa_at_q21g2000yqm.googlegroups.com...
> On Mar 3, 5:45 am, Pedro <pedro.p..._at_gmail.com> wrote:
>
>
>
> > Good morning people. I need quiet an odd help in here. Let me see if I
> > can explain it.
>
> > I have an SELECT WHERE IN (<list of ids>).
> > Let us say that I sent the following list of ids: 1, 2 and 3.
>
> > There is only resulting records for the ID = 3, but I'd like to see
> > all the ids, even if they don't have records...
> > I expect the following result for instance:
>
> > ID DESC
> > 1
> > 2
> > 3 Test
>
> > Any suggestion on how to do this? I have here the complete statement,
> > but I don't think it would help for now...
>
> Here's a little nicer version:
>
> WITH counter AS (SELECT level id FROM dual CONNECT BY level <=3)
> SELECT c.id, t.*
> FROM counter c
> LEFT OUTER JOIN table t ON c.id = t.id
Date: Thu, 4 Mar 2010 10:50:52 -0800 (PST)
Message-ID: <f3e774ae-3a47-4946-a5bd-0493e38401d1_at_q21g2000yqm.googlegroups.com>
On Mar 4, 5:55 am, "Marconelli" <m..._at_NOSPAM.go2.pl> wrote:
> Uzytkownik "jefftyzzer" <jefftyz..._at_sbcglobal.net> napisal w wiadomoscinews:07c710d1-5277-4e8f-971f-4d5dfb7764aa_at_q21g2000yqm.googlegroups.com...
> On Mar 3, 5:45 am, Pedro <pedro.p..._at_gmail.com> wrote:
>
>
>
> > Good morning people. I need quiet an odd help in here. Let me see if I
> > can explain it.
>
> > I have an SELECT WHERE IN (<list of ids>).
> > Let us say that I sent the following list of ids: 1, 2 and 3.
>
> > There is only resulting records for the ID = 3, but I'd like to see
> > all the ids, even if they don't have records...
> > I expect the following result for instance:
>
> > ID DESC
> > 1
> > 2
> > 3 Test
>
> > Any suggestion on how to do this? I have here the complete statement,
> > but I don't think it would help for now...
>
> Here's a little nicer version:
>
> WITH counter AS (SELECT level id FROM dual CONNECT BY level <=3)
> SELECT c.id, t.*
> FROM counter c
> LEFT OUTER JOIN table t ON c.id = t.id
"SELECT level id FROM dual CONNECT BY level <=3"--very nice ;-)
--Jeff Received on Thu Mar 04 2010 - 12:50:52 CST