>Hello All,
>
>I have a sql question about visual foxpro 2. I have two tables, let's call them table1 and table2. Let's say we have a cId in both tables.
>
>I want to select all records for all fields from table1 and select records for a particular field from table2 where the cId of table2 equals(or is within) the cId of table1 into a query/table/cursor. It's kind of an union I think.
>
>I have tried anything, but nothing works for me. How could this be done?
>
>Help would be appreciated.
>
>Zakaria al Azhar
SELECT Table1.*, Table2.SomeField ;
FROM Table1
LEFT OUTER JOIN Table2 on Table1.cId = Table2.cID ;
INTO...
You may want to use the NVL function around the field from Table2 so that null values don't show up as NULL.