Hi Sergey
I take your advice on board, thx
but I only have 4 records in LINEMARKINGHEAD, but the cursor has 39 records in it?
>It's better to use JOINs and formatimg to make your query readable
>
>SELECT linemarkinghead.icustno, customers.ccompany, sites.name ;
> FROM linemarkinghead ;
> JOIN customers ON linemarkinghead.icustno = customers.icustno ;
> JOIN sites ON linemarkinghead.siteno = sites.code ;
> INTO CURSOR tmp
>
>
>The only way you get more records by adding joins, if there're duplicate icustno in customers or/and code in sites.
>
>>
>>I'm trying to create a cursor from three tables
>>
>>LINEMARKINGHEAD (parent)
>>CUSTOMERS (child) ICUSTNO
>>SITES (child) CODE
>>
>>I want to extract all records from LINEMARKINGHEAD, but have the cursor contain the customer name and sitename. The line below works fine:-
>>
>>
>>SELECT linemarkinghead.icustno,customers.ccompany FROM linemarkinghead,customers WHERE linemarkinghead.icustno=customers.icustno INTO CURSOR listtmp
>>
>>
>>but when I try to add the site I get far too many records:
>>
>>
>>SELECT linemarkinghead.icustno,customers.ccompany,sites.name FROM linemarkinghead,customers,sites WHERE ;
>>linemarkinghead.icustno=customers.icustno AND linemarkinghead.siteno=sites.code INTO CURSOR tmp
>>
>>
>>Can you not have two children in a SELECT SQL statement?
Rob