Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select with multiple joins
Message
From
20/08/1999 17:52:48
 
 
To
20/08/1999 13:56:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00255950
Message ID:
00256090
Views:
33
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!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform