Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One to many select statement - want one row with data
Message
De
19/05/2006 16:49:25
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
One to many select statement - want one row with data
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
SAMBA Server
Database:
Visual FoxPro
Divers
Thread ID:
01123686
Message ID:
01123686
Vues:
67
Hi Everyone:

I have a one-to-many table design (now that i know what one is :-) ) and am trying to use a select statement to get the data in one row, so to speak.

one table has contacts, another has phone types (ie home, home2, cell), and the third table has the contact_id, the phone_id (ie which type of phone), and the phone #. Obviously, a lot of people have more than one phone # so for each contact_id in the third table, there is more than 1 result.

I want to select this information in a query so it shows up in one record, not multiple records, based on each person's id (or for this example, their last name). For example, Joe Smith will have 4 different phone numbers. His contact_id is 1.

select f_lname, f_phone from t_contacts, t_phone where;
t_contacts.f_id = t_phone.contact_id;
group by f_lname, f_phone

I end up with the following;
Smith phone#1
Smith phone#2
Smith phone#3
Smith phone#4

I thought the group by clause would take care of this, but what i want to receive is
Smith phone#1 phone#2 phone#3 phone#4

I hope this makes sense. it feels like i'm missing something simple here, and while i could probably do this with multiple queries, i'm hoping there's an easier way. Is there? Thanks.

Paul
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform