Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query question
Message
From
19/05/2006 19:54:44
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Query question
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01123711
Message ID:
01123711
Views:
47
Hi All

I have a contacts system that has four tables, Names, address, phonenumber, email. The last three have a nameFK foreign key that joins with the names table. I designed it this way so I could have multiple entries of each time of contact info. I have two rows in address, three rows in phonenumber and two rows in email. I am trying to create a query that will give me three rows (rows in phonenumber). What I am getting is 18. Is there a way to do this or am I going to need to redesign the tables. I am using Syabase ASA database.

Here is my Query. Thanks.
select  * 
from   names na
left outer join address ad
on ad.namefk = na.namepk
left outer join email em
on em.namefk = na.namePK
left outer join phonenumber  ph
on ph.namefk = na.namePK
where  na.namepk= 1
Next
Reply
Map
View

Click here to load this message in the networking platform