OK here it is.
I have a table with claims pk=claim_id
and three many to many tables containg
Claimants
Carriers
Employers
a claimant can belong to many claims
a employer can belong to many claims
a carrier can belong to many claims
a lcaim can have serveral claimants, employers, and/or carriers
To accomplich this I have in addition to the tables above (claims, carriers,employers,claimants)
a table called links
link_id I,;
parent_id I,; && =claim_id
child_id,; && =claimant_id,employer-id, or carrier_id depending on :
ltype c(4),; && 'CLCA'=child= carrier_ID,
&& 'CLRE'=child_id= employer_id,
&& 'CLCT'=child_id=claimant_id,;
percent....
and a few more data fields pertaining to the intersection of claims and the employer etc.
now in the query if a claim hase for example 3 claimants I ned to have 3 lines with just the claimant info different
if there are alose 3 carriers I need 3 more line containing the same claim info but with the 3 carrier names etc
What I would like the best wourd be a treeview like grid
here is part of the query method:
SELECT &cFieldList,0000000 AS LINENO;
FROM claims ;
LEFT JOIN links la ON la.parent_id=claim_id AND la.ltype="CLRE";
LEFT JOIN links lb ON lb.parent_id=claim_id AND lb.ltype="CLCA";
LEFT JOIN links lc ON lc.parent_id=claim_id AND lc.ltype="CLCT"; LEFT JOIN respond ON la.child_id=respond_id;
LEFT JOIN carrier ON lb.child_id=carrier_id;
LEFT JOIN claimnt ON lc.child_id=claimnt.claimnt_id;
LEFT JOIN sys_user ON claims.analyst_id=sys_user.user_id;
LEFT JOIN statute ON lc.statute_id=statute.statute_id;
WHERE &lcWhere ;
INTO CURSOR cc1 ;
READWRITE
liTally=_TALLY
WAIT CLEAR
ENDIF
.grd1.RECORDSOURCE="cc1"
ENDWITH
>Hi Peter
>
>>it does not return the correct set
>
>And then ....
>- where are the bad set rows ?
>- explain tables structure
>- explain index structure
>
>Try a reindex
>
>Fabio
Peter Cortiel