Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subquery or Derived query question?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01540168
Message ID:
01540170
Vues:
30
>>Hi,
>>
>>I forgot again how to create query that contains group of records of parent table and then details of child. I think this is done with either subquery or derived query but I can't remember which one and how.
>>
>>Here is an example.
>>Table 1 parent with columns FLD1, FLD2
>>
>>Table 2 is a child table with a FK column FLD1 (matching FLD1 in Table1)
>>
>>I want to create a query that groups by Table 1 FLD1, FLD2 and contains all columns of table Table2
>>
>>For example,
>>
>>
>>select Table1.FLD1, Table1.FLD2 -- add all columns from Table2 -- from Table2 group by Table1.FLD1, Table1.FLD2
>>
>>
>>TIA.
>
>Then all fields from Table2 should be in aggregate functions.
>But if you give me an example data and desired result it will be easier for me to answer :-)

When you are saying aggregated functions it would be MAX(FldA), MAX(FldB), and so on, right?

Here is an example.

Table SCHEDULE. has column EQ_ID (equipment ID), EMPL_ID (employee ID) and a bunch of other not important columns.

Table EQUIPMENT has column EQ_ID, BUILDING, TYPE, and a bunch of other important columns.

I want the resulting query to have

EQ_ID, EMPL_ID, EQUIPMENT.BUILDING, EQUIPMENT, TYPE, .. and so on GROUP BY SCHEDULE.EMPL_ID, EQ_ID.

That is, I want to see detailed information for each EMPLOYEE. Hopefully my explanation is clear. Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform