Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Query
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00790324
Message ID:
00790332
Vues:
20
Use Union clause.

Aashish


>Good Morning,
>
>I have a table named modacad which lists a number of records that have a type associated with them. The four types are SAMPLE, TECHNICAL, COST EXERCISE or MOCK-UP, the type field is known as modacad.key4. I would like to produce a list of records of all samples and also any matching technical records. Therefore I have created 2 SQL statements:
>
>STATEMENT1
>
>SELECT modacad.key1, modacad.key2, modacad.key3, modacad.key4, modacad.mainkey ;
>FROM "U:\Data\modacad.dbf" ORDER BY modacad.key1 ;
>WHERE modacad.key4='SAMPLE' ;
>INTO CURSOR result1
>
>STATEMENT 2
>
>SELECT modacad.key1, modacad.key2, modacad.key3, modacad.key4, modacad.mainkey ;
>FROM "U:\Data\modacad.dbf" ORDER BY modacad.key1 ;
>WHERE modacad.key4='TECHNICAL' ;
>INTO CURSOR result2
>
>This will give me in one cursor all samples and in the other cursor all technicals.
>
>What I would like to do now is to join the 2 tables together so that it will list all Samples and ONLY those records that are Technical. Both the samples records and the equivalent technical records have the same ID. For example
>
>This is what I have
>
>JKT001 Sample
>JKT001 Technical
>JKT001 Mock-up
>JKT002 Sample
>JKT003 Sample
>JKT003 Technical
>JKT004 Sample
>JKT004 Mockup
>
>When I run the query it needs to list all samples and those matching Technicals. Therefore my results should say.
>
>JKT001 Sample
>JKT002 Sample
>JKT003 Sample
>JKT001 Technical
>JKT003 Technical
>JKT004 Sample
>
>therefore I want all sample records + any matching technical records.
--
--
Aashish Sharma
Tele Nos: +1-201-490-5405
Mobile: +91-9821053938
E-Mail:
aashish@aashishsharma.com
write2aashish@gmail.com

You better believe in yourself... if you don't, who else will ?
TODAY is a gift, that's why it's called PRESENT
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform