Complex Query Building Help

  • Thread starter Thread starter Murtaza
  • Start date Start date
M

Murtaza

Hi,
I am having a problem in building this query, here's the situation:

I have 3 tables 'a' 'b' and 'c'
Now in 'a' there are two fields 'alias' and 'aid', in 'b' there are
two fields 'category' and 'bid' and in 'c' there are two fields 'aid'
and 'bid' (these fileds contains ids from 'a' and 'b' table where they
matched!

Now what i want to do is to get 'alias' from 'a' table of 'category'
from 'b' table where both tables' ids are matched in third table 'c'
both tables' id are placed in third table 'c'

kindly help me with the solution

database type is MS ACCESS 2003
 
Hi,
I am having a problem in building this query, here's the situation:

I have 3 tables 'a' 'b' and 'c'
Now in 'a' there are two fields 'alias' and 'aid', in 'b' there are
two fields 'category' and 'bid' and in 'c' there are two fields 'aid'
and 'bid' (these fileds contains ids from 'a' and 'b' table where they
matched!

Now what i want to do is to get 'alias' from 'a' table of 'category'
from 'b' table where both tables' ids are matched in third table 'c'
both tables' id are placed in third table 'c'

kindly help me with the solution

database type is MS ACCESS 2003

Just add all three tables to the query grid.

Join the aid field from A to the aid field in C, and similarly join the bid
field from B to the bid field in B.

Select whichever fields you would like displayed.
 
Just add all three tables to the query grid.

Join the aid field from A to the aid field in C, and similarly join the bid
field from B to the bid field in B.

Select whichever fields you would like displayed.

actually i am working on a web project using ms access on backend and
coldfusion, the solution you given me can be used on ms access
program, so can you provide me constructed query so i can than be able
to implement on my page
 
actually i am working on a web project using ms access on backend and
coldfusion, the solution you given me can be used on ms access
program, so can you provide me constructed query so i can than be able
to implement on my page

Using the table and fieldnames you posted (since I can't guess what the actual
ones might be), and selecting only the fields that you've posted,

SELECT A.Alias, B.Category, <any other fields you like)
FROM (A INNER JOIN C ON A.aid = C.aid)
INNER JOIN B ON B.bid = C.bid;
 
Back
Top