Hi all,
I have 3 tables which I need to get data from a single query. Below is a
query with one join between two of the tables but I cannot figure out how to
add the third table without killing the server. The following example
executes in less than .20 seconds when I add the third table the server just
about dies (well I give it 30 seconds).
In the following two tables there are no records in ar_ledger and there are
1000 records in customers.
select customers.cust_id,first,last,sum(amount) as balance from customers
left join main.ar_ledger on customers.cust_id = main.ar_ledger.cust_id group
by customers.cust_id limit 10;
I have another table called passwd which has a field labeled cust_id. I need
the first matching row from passwd for each cust_id in customers.
Make sense?
If I use:
select customers.cust_id,customers.first,customers.last,sum(amount) as
balance,system.passwd.pw_name from customers left join main.ar_ledger on
customers.cust_id = main.ar_ledger.cust_id left join system.passwd on
system.passwd.cust_id = customers.cust_id group by customers.cust_id limit
10;
The query runs for a LONG time...I have to abort it...
Anyone got any ideas?
-Dave
California Internet Connection
| Thread |
|---|
| • Can someone help with a multiple Join ? | Dave | 25 Mar |