I have a DB with 3 tables that I need data from. Here is the deal...
I have 1 table that holds merchants, one that holds sales reps, and one that holds their residuals. I have the following statement that grabs all of the sales from the residuals table along with the name of the sales rep from the salesrep table. Basically, it takes the sid in the residuals table and matches it to the sid in the sales table to display the salesrep name. I also need the merchant name for each sale from the merchant table. This is where I'm stuck. Here's what I have and it works to get the rep name, and some stats from residuals...
$sql="SELECT salesrep.name,residuals.locationfirstactivation,residuals.reportdate,residuals.nsfcollected,residuals.payoutnsf from salesrep,residuals WHERE salesrep.sid = '{$_GET["sid"]}' AND salesrep.sid = residuals.sid"
There is also an mid (merchant ID) field in the merchant table where I need to grab which merchant the sale was for.
Would someone please help me with the SQL syntax for this? I've been working on this for a while this morning and normally wind up in a HUGE loop. I can paste the schema of the DB here if needed.
Thanks,
Adam