Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need help with a right join (I think?)
Message
 
To
24/08/1999 13:26:45
Oleg Khvalin
The Sutherland Group Ltd
Rochester, New York, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00256837
Message ID:
00257231
Views:
33
Yes, Yes, Yes..... that pushed me in the right direction.

I got what I wanted with:
SELECT distinct catlink.ab_id, catagory.catagory ;
	FROM catlink ;
	RIGHT OUTER JOIN catagory ;
	ON catagory.catagory = catlink.catagory ;
	and ab_id=57 ;
	order by 2

-or-

SELECT distinct iif(catlink.ab_id = 57, .t., .f.), catagory.catagory ;
	FROM catlink ;
	right OUTER JOIN catagory ;
	ON catagory.catagory = catlink.catagory ;
	and ab_id=57 ;
	order by 2
Now I can use that as a recordsource for a grid with checkbox column to show whether ab_id belongs to a catagory.

Thanks Jim, Mike, and Oleg. I'm happy, that replaced about 30 lines of really ugly code.

>Jim,
>The good place to filter inner table of an outer join is the ON portion of the FROM clause:
>SELECT Catagory.Catagory, CatLink.Ab_id ;
> FROM Catagory LEFT OUTER JOIN CatLink ;
> ON Catagory.Catagory = CatLink.Catagory ;
> and ab_id=52 ;
> INTO CURSOR MyResult
>
>It eliminates Fox-specific LOCATE and will work on the server.
>In ANSI SQL-92 standard the outer join performs first and WHERE clause restricts result set.
>Note that pre SQL-92 syntax works one way on SQL SERVER and SYBASE (performs WHERE first, than JOIN), another on ORACLE.
>
>HTH
>Oleg
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform