engineroom
asked on
INNER JOIN triple help...
hey all, i'm using an inner join query and it does what i want it to do, i need to add another join to get info from another table and i can't seem to get it right, i thought i had it at one point but it didn't work. here's the query that does what i want it to do....
SELECT loanType,creditHistory from (leads INNER JOIN leads_link ON leads_link.leadID=leads.le adID) INNER JOIN brokers on leads_link.brokerID=broker s.brokerID where leads.dateON between #1/16/2007# And #2/1/2007#
Now, i need to add to this a sales table which shares the salesID in the brokers table. So here's the structure for that...
Sales brokers
-------- ---------------
salesID salesID
So here's what i tried to do, but it didn't work...
SELECT sales.salesID, sales.fname, loanType,creditHistory from ((leads INNER JOIN leads_link ON leads_link.leadID=leads.le adID) INNER JOIN brokers ON leads_link.brokerID=broker s.brokerID ) INNER JOIN sales ON brokers.salesID=sales.sale sID) where leads.dateON between #1/16/2007# And #2/1/2007#
Am i close? I'm using MS Access. Thanx all. Hope this makes sense.
SELECT loanType,creditHistory from (leads INNER JOIN leads_link ON leads_link.leadID=leads.le
Now, i need to add to this a sales table which shares the salesID in the brokers table. So here's the structure for that...
Sales brokers
-------- ---------------
salesID salesID
So here's what i tried to do, but it didn't work...
SELECT sales.salesID, sales.fname, loanType,creditHistory from ((leads INNER JOIN leads_link ON leads_link.leadID=leads.le
Am i close? I'm using MS Access. Thanx all. Hope this makes sense.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
okay, that worked but didn't render any results.... don't get it.. the original query gives me 16 results, this should do the same. What's wrong?
Are the salesID's populated in your brokers table for the records in that date range? Also, are these possibly leads that have not yet resulted in sales, hence no salesID associated yet?
Preece
Preece
Hmmm...try switching the order of tables in the last two joins:
INNER JOIN brokers ON leads_link.brokerID=broker s.brokerID ) INNER JOIN sales ON brokers.salesID=sales.sale sID)
INNER JOIN brokers ON brokers.brokerID = leads_link.brokerID) INNER JOIN sales ON sales.salesID = brokers.salesID)
Preece
INNER JOIN brokers ON leads_link.brokerID=broker
INNER JOIN brokers ON brokers.brokerID = leads_link.brokerID) INNER JOIN sales ON sales.salesID = brokers.salesID)
Preece
ASKER
That didn't do anything. :o\
ASKER
Anyone else? FtB? acperkins?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well,engineroom, any luck with any of the above?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Badotz
That didn't return any results.
@YZlat
Syntax error (operator missing)
@acperkins
Syntax error (operator missing)
Thanx guys. for everything.
That didn't return any results.
@YZlat
Syntax error (operator missing)
@acperkins
Syntax error (operator missing)
Thanx guys. for everything.
ASKER
okay guys, i think i know what's going on. All the code provided, including mine wasn't bad. The results are returning ID's that don't exist anymore, therefore, no results. Thanx all for your help and for your patience. I'm gonna split the points between all of ya'll.
er
er
Preece