Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where filter on file in SQL Left Outer join
Message
From
23/08/2005 06:02:42
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/08/2005 05:45:16
Richard Candeland
Richard Candeland Software Services
Keighley, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01042840
Message ID:
01042844
Views:
18
>I have a 3 file query. For every record in file A, there is a record in file B, but only some records in files A/B have a record in file C.
>
>In VFP 6 I had a query with a left outer join to file C and a where filter on file C:
>
>select ....
> from A join B on A.memb_no = B.memb_no ;
> left outer join C on A.memb_no = C.memb_no ;
> where C.lastpaid > dlDate
>
>This produced the result I wanted: All records from file A where there was either no record in file C or there was a record in file C and field lastpaid had a date later than variable dlDate.
>
>In VPF 8, the result is different. I lose all the records from file A where there is no record in file C.
>
>I can see now that my SQL syntax was sort of ambiguous, but what should it be? Is it possible to get what I want in a single SQL statement?

I'm not sure this query would bring in all records from A,B even in VFP5. Anyway try this:
select ....
  from A join B on A.memb_no = B.memb_no ;
    left outer join C on A.memb_no = C.memb_no ;
    and C.lastpaid > dlDate
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform