Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can not get this right
Message
From
26/05/2008 03:45:11
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01319440
Message ID:
01319478
Views:
9
SELECT People.cID,;
       MAX(LName) AS LName,;
       MAX(FName) AS FName,;
       MAX(IIF(Phones.Type=='Home'  , Phone, CAST([] AS C(??))) AS Home,;
       MAX(IIF(Phones.Type=='Office', Phone, CAST([] AS C(??))) AS Office,;
       MAX(IIF(Phones.Type=='Cell'  , Phone, CAST([] AS C(??))) AS Cell,;
....
FROM People;
INNER JOIN Phones ON People.cId == Phones.cId;
GROUP BY People.cID
That wold give you only one contact per person, but I read Naomi's quest to have one person with seveveral contact possibilities. Adding phones under a different alias in 1 join for each contact type should resolve at least that, but if a person has 2 cell phones, this info would still be lost.

First coffee is still being created, so I might be wrong.

regards

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform