i think you should have a sales person table that hold unique id for each sales force such as
salesrep (id,etc..) | 101 | ... | | 102 | ... | so you can alter the query into select salesrep.id, sum(ifnull(salesinvoices.invamt,0)) as curramt, sum(ifnull(lysalesinvoices.lyinvamt,0)) as lyamt from salesrep left join salesinvoices on salesrep.id=salesinvoices.salesrepid left join lysalesinvoices on salesrep.id=lysalesinvoices.salesrepid group by salesrep.id hope this help.. -Leo-