Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Denormalizing tables
Message
 
 
To
15/07/2002 03:14:13
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00678546
Message ID:
00678637
Views:
17
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform