Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Join
Message
 
 
À
17/12/2004 20:54:03
Information générale
Forum:
Oracle
Catégorie:
PL/SQL
Titre:
Re: Join
Divers
Thread ID:
00970267
Message ID:
00970277
Vues:
38
YOu can always select from the same table more than once as long as you alias the tables. Something like:
SELECT
   A.TopicDate, A.TopicSubject,
   A.TopicFrom,
   B.StudentName AS FromStudentName,
   B.EmailAdd    AS FromStudentEmail,
   A.TopicTo,
   C.StudentName AS ToStudentName,
   C.EmailAdd    AS ToStudentEmail
FROM Topics1 A, Student B, Student C
WHERE A.TopicFrom = B.StudentID
  AND A.TopicTo = C.StudentID
>Dear The Expert,
>
>I have 2 tables:
>
>- Student
> StudentID VARCHAR(5)
> StudentName VARCHAR(50)
> EmailAdd VARCHAR(50)
>
>- Topics1
> TopicDate DATE
> TopicSubject VARCHAR(50)
> TopicFrom VARCHAR(5)
> TopicTo VARCHAR(5)
>
>Joining criteria: TopicFrom = StudentID and TopicTo = StudentID
>
>How to join the above tables into 1 table?
>What I need is: to get the following fields:
>
>TopicDate, TopicSubject, TopicFrom, FromStudentName, FromStudentEmail, TopicTo, ToStudentName, ToStudentEmail
>
>please advise and many thanks in advance
>
>Regards
>Winanjaya
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform