Hi Cathy
Was just trying to look up the customer name, and sitename and stick it in the cursor.
I was going from header to customer, and header to site in my SQL.
I should have been going from header to customer, and header to site.
All sorted now, SQL is fantastic but I don't use it enough.
Thx anyway
>>Hi
>>
>>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?
>
>Give an example of the data and what you want as the output. If there are 2 customers for a given parent and only one site for that given parent .. what do you want to see.
Rob