>>- both files have to be from the same Plaintiff (field Plaintf_ID)
>>- files cannot be the same File_Type (one must be a "P" and the other a "D")
>>- File_ID is the primary key
>>- PartFile is the table that holds one record for each "file" (law firms sometimes call this a "matter")
I'm expecting you could do this with a self-join along the lines of
SELECT ;
P.Plaintf_ID, P.File_ID, P.Lastname, P.Firstname, P.Partner, P.Our_FileNo, P.Plain_Defn ;
from partfile P inner join partfile D on P.Plaintf_ID=D.Plaintf_ID and P.file_type='P' and D.file_type='D' ;
where P.settled=.T. and empty(D.date_fund) and empty(D.date_closd) ;
INTO CURSOR SettledNF READWRITE
You'd need to refine the WHERE clause to match exact settled/funded requirements for the P and D files, but that ought to be easy enough.
Also note that some people would consider the join to be overloaded, with file_type clauses best moved to the WHERE, but I don't think this affects Rushmore and I find it more legible. You might want to experiment with join versus where if the query is slow.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us."
-- Shakespeare: Coriolanus, Act 1, scene 1