Microsoft KB Archive/165308

= FIX: Left Outer Join with "WHERE NOT IN" Clause Incorrect =

Article ID: 165308

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition

-



This article was previously published under Q165308



SYMPTOMS
Left Outer Join with the WHERE NOT IN clause displays the wrong fields in the cursor. The cursor replaces one of the fields that should be in the cursor with the field in the SELECT statement in the WHERE NOT IN clause.



RESOLUTION
Use the Outer Join syntax used in Visual FoxPro 3.0.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual FoxPro 5.0a for Windows.



Steps to Reproduce Behavior
  Run the following code: CLOSE ALL ERASE one.dbf ERASE two.dbf ERASE three.dbf CREATE TABLE one (id c(5),first c(10)) CREATE TABLE two (id2 c(5), secnd c(10)) CREATE TABLE three (id3 c(5),third c(10)) INSERT INTO one(id,first) VALUES('11111','one') INSERT INTO one(id,first) VALUES('22222','two') INSERT INTO one(id,first) VALUES('33333','three') INSERT INTO one(id,first) VALUES('44444','four')

INSERT INTO two(id2,secnd) VALUES('11111','uno') INSERT INTO two(id2,secnd) VALUES('22222','duo') INSERT INTO two(id2,secnd) VALUES('33333','tre')

INSERT INTO three(id3,third) VALUES('22222','whatever')

SELECT one.id,one.first,two.id2,two.secnd ; FROM one LEFT OUTER JOIN two ON one.id=two.id2 INTO CURSOR cursor1 BROWSE NOWAIT SELECT one.id,one.first,two.id2,two.secnd ; FROM one left OUTER JOIN two ON one.id=two.id2 WHERE two.id2 ; NOT IN (SELECT id3 FROM three) INTO CURSOR cursor2 BROWSE NOWAIT  Compare the two Browse windows.

The cursor2 Browse window displays id3 instead of id2.

