Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6 creating cursor
Message
From
09/12/2000 22:11:45
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00451015
Message ID:
00451289
Views:
27
James,
SELECT Table1.*, Table2.Name ;
    FROM Table1 LEFT JOIN Table2 ;
    ON Table1.Comp_no = Table2.Comp_no ;
    INTO CURSOR TableTemp
This will give you all records in Table1. The ones with a match in Table2 will have the Name filled in, the others will have .NULL. in that field. If you don't want the nulls, you can use NVL(Table2.Name, SPACE(30)) AS Name.

Another way is to use:
SELECT Table1.*, ;
    LOOKUP(Table2.Name, Table1.Comp_no, Table2.Comp_no, [Comp_no]) ;
    FROM Table1 ;
    INTO CURSOR TableTemp
>Hi All,
>
>I'm trying to create a cursor but keep getting a 'cartesian' join.
>
>Table1 has 96,000 + records.
>
>table2 has 24,000 + records.
>
>I want all the records in table one and I'm only looking for the data in a specific field of table2.
>
>The resultant table should include all the fields in table1 and only the table2.name field information.
>
>The comparable field in both tables is the comp_no field.
>
>Here's one of many miserable attempts.
>
>select tabel1.*, table2.name from table1, table2 where table1.comp_no = table2.comp_no into cursor tabletemp
>
>The above gives me 800,000 + records, I only want table1 records with the name field incorporated.
>
>I'd appreciate any help, guidance.
>
>TIA.
>
>Jim Harvey
>jharvey@netrax.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform