[Solved]Complex Query Help
Posted: Mon Oct 04, 2004 6:30 am
Here is what I got:
I got a table with webmasters and one with customer billing data.
I now want to query a list of each webmasters earnings that were referred by another webmaster.
So basically it should sum the Amounts for each webmaster out of the monthly billing table.
I think 2 queries might do the job:
1 to determine the webmasters
and then loop thru all webmasters with the 2.
Can I put this in one query?
I got a table with webmasters and one with customer billing data.
I now want to query a list of each webmasters earnings that were referred by another webmaster.
So basically it should sum the Amounts for each webmaster out of the monthly billing table.
I think 2 queries might do the job:
1 to determine the webmasters
Code: Select all
SELECT Web_ID FROM Webmasters WHERE Referrer = '10152'Code: Select all
SELECT SUM(m.Amount) FROM Customers c, Monthly_Billing m WHERE c.Webmaster = '$webmaster' AND m.Customer = c.Customer