thanks for the reply, strangely emough the file in my system is RM20201, RM30201 is empty. Maybe we have different versions or different implenentations.
Anyway, for the crystal report it needs to have a link to the salesperson file as well as to the invoice master(names are my own) so the query I have looks something like this:
SELECT
SOP30200."SOPNUMBE", SOP30200."INVODATE", SOP30200."CUSTNAME", SOP30200."SLPRSNID",
RM00301."SLPRSNFN", RM00301."SPRSNSLN", RM00301."COMPRCNT",
RM20201."APPTOAMT"
FROM
"SOP30200" SOP30200,
"RM00301" RM00301,
"RM20201" RM20201
WHERE
SOP30200."SLPRSNID" = RM00301."SLPRSNID" AND
SOP30200."SOPNUMBE" = SOP30300."SOPNUMBE" AND
SOP30200."SOPNUMBE" = RM20201."APTODCNM" AND
SOP30200."INVODATE" >= ? AND
SOP30200."INVODATE" <= ? AND
SOP30200."SLPRSNID" >= 'aaaaaaa' AND
SOP30200."SLPRSNID" <= 'zzzzzzzzzzzzzzz'
ORDER BY
SOP30200."SLPRSNID" ASC,
SOP30200."CUSTNAME" ASC,
SOP30200."SOPNUMBE" ASC
THe only problem is that since I need to refer back to the invoice master for the saleserson id, my join is giving me duplicate records which dissapear when I do a select distinct on MS QUery but it's not supported on btrieve.
Is there another table that I can use to link back to for the salesperson ID besides SOP30200?