Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Denormalizing tables
Message
 
 
À
15/07/2002 03:14:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00678546
Message ID:
00678637
Vues:
16
Assuming that the address table has 'addrtype' field that identifies type of address stored.
SELECT bs.nname, ;
         NVL(a1.street, SPACE(LEN(a1.street))) AS adr1street, ;
         NVL(a2.street, SPACE(LEN(a2.street))) AS adr2street, ;
         NVL(a3.street, SPACE(LEN(a3.street))) AS adr3street, ;
         NVL(a4.street, SPACE(LEN(a4.street))) AS adr4street ;
  FROM base bs ;
   LEFT JOIN address a1 ON a1.keyfield = bs.keyfield ;
           AND a1.addrtype = "A1" ;
   LEFT JOIN address a2 ON a2.keyfield = bs.keyfield ;
           AND a2.addrtype = "A2" ;
   LEFT JOIN address a3 ON a3.keyfield = bs.keyfield ;
           AND a3.addrtype = "A3" ;
   LEFT JOIN address a4 ON a4.keyfield = bs.keyfield ;
           AND a4.addrtype = "A4" ;
...
>Hello Sergey,
>
>sorry but i don't made me question clear.
>
>i meant joining the base table with 4 addresses out of ONE address table
>which holds all the addresses
>
>Regards
>
>Christian
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform