Re: [HELP] Please, help with a simple SELECT statment

From: Ethel Aardvark <bigjobbies_at_hotmail.com>
Date: 9 Jun 2003 06:15:46 -0700
Message-ID: <1a8fec49.0306090515.4f1c575e_at_posting.google.com>


I used to have trouble remembering which side the (+) goes on but I worked out an easy clue - it is the side which needs missing records to be ADDed as nulls.

ETA. "Dave Hau" <davehau-no-spam-123_at_no-spam.netscape.net> wrote in message news:<sUQEa.387$od.31485068_at_newssvr15.news.prodigy.com>...
> Ezio, you have the outer join backwards. If you want all the rows in the
> Student table regardless of whether the tut_id column joins with the Tutors
> table, the query should be:
>
> SELECT *
> FROM students, tutors
> WHERE students.tut_id = tutors.tut_id (+);
>
> Cheers,
> Dave
>
>
>
>
> "Ezio" <vscudel_at_tin.it> wrote in message
> news:gnDEa.57938$pR3.1237560_at_news1.tin.it...
> > Your solution is
> > SELECT * FROM STUDENTS,TUTORS
> > WHERE STUDENTS.Tut_ID(+)=TUTORS.Tut_ID;
> > "Juan Guillermo Fernández V." <promodeus_at_hotmail.com> ha scritto nel
> > messaggio news:bbu5pa$k65$1_at_news1.nivel5.cl...
> > > Hi everybody.
> > >
> > > I've been working for a just a while now with Oracle (or with any DB for
> > > that matter. I'm really new to all this), and I've encountered a problem
 I
> > > can't find a solution to.
> > >
> > > I've created a table... let's call it "STUDENTS". It has a Primary Key
 field
> > > (St_ID) and a bunch of other fields. It also has a Foreign Key (Tut_ID),
 an
> > > dientification for his Tutor, a reference to the TUTORS table. The thing
 is,
> > > a student MAY or MAY NOT have a tutor, so the Foreign Key field Tutor
> MAY
> or
> > > MAY NOT have data; id est, it May have an ID number, or else it will be
> > > NULL.
> > >
> > > Now, here's where I'm having the problem. When I do a simple:
> > >
> > > SELECT * FROM STUDENTS,TUTORS
> > > WHERE STUDENTS.Tut_ID=TUTORS.Tut_ID;
> > >
> > > it shows me only those rows WITH something on the Tut_ID field... and I
 was
> > > hoping (and need) to list every row ond STUDENTS, adding the Tutor data
 when
> > > it's present, ommiting it (empty fields) when is not...
> > >
> > > Maybe there is an obvious way to do this, just a simple instruction...
 but
> > > I'm reourceless on this.
> > >
> > > Pleasy. Any help would be enourmosly appreciated. thanks!
> > >
> > > PS: Sorry for my english, if it tourns out inintelligible or horrible
> > > misspelled.
> > >
> > >
> >
> >
Received on Mon Jun 09 2003 - 15:15:46 CEST

Original text of this message