Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outer join for a many-to-many relationship
Message
From
18/11/1999 10:57:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00292467
Message ID:
00292476
Views:
21
>I have PERSON and LICENSE. One person may have more than one license. One license may be issued to more than one person. Either the person or the license may be in both circumstances. That is, a person may be the only holder of one license and a shared holder of another license. Similarly, a license may be held by one person who may or may not hold another license, and those licenses may be single or shared as well.
>
>PERSON.pk_person is a primary key, and LICENSE.pk_license is primary
>pk_person = 'P00000' and pk_license = 'L00000' are in each table for a 'blank' person or license.
>
>I would appreciate your guidance on an SQL-SELECT statement that will make a join table for this, selecting the pk from each table where there are matches, and supplying the 'blank' to make a match where there are none.
>
>That is, if a PERSON.Pnnnnn does not have a license, he is still in the join table as JOINED.fk_person = PERSON.Pnnnnn with license JOINED.fk_license = 'L00000' Similarly, if a license is issued, but not to a person (e.g. a business) the license is still in the join table 'Lnnnnn' with person 'P00000'
>
>Thanks for any help


Sounds like :
select * from Person ;
 full join License ;
   on person.fk_person = license.pk_license
I got "person.fk_person" as foreign key linking to license (fk_person = "L00000" for pk_person = "P00000" and so on).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform