Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select with multiple joins
Message
De
20/08/1999 17:52:48
 
 
À
20/08/1999 13:56:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00255950
Message ID:
00256090
Vues:
32
Hi Erik,

>SELECT ARCust.*, Address1.Address, Address2.Address FROM ARCust, Address Address1, Address Address2 WHERE ARCust.AddressID1 = Address1.ID and ARCust.AddressID2 = Address2.ID

This won't work, saddly. This will eliminate records which don't have the optional shipto address, where a left join leaves an unmatched in. I was hoping to do something like:
select a.arno, b.lname, c.lname as shiplname;
	from ar a left join address b on a.id_addr = b.id_addr,;
	ar a left join address c on a.id_ship=c.id_addr ;
	into cursor temp

whcih doesnt work, so I

select a.arno, b.lname, c.lname as shiplname;
	from ar a left join address b on a.id_addr = b.id_addr, address c ;
	where a.id_ship = c.id_addr;
	union (select a.arno, b.lname, c.lname as shiplname;
	from ar a left join address c on a.id_ship=c.id_addr, ;
	address b where a.id_ship = 0 and a.id_addr = b.id_addr);
	into cursor temp
instead. I don't like and will keep looking however. There are few times when this "Optional Foreign Key" get in my way so I won't need to do this to often. Thanks for your help, though!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform