What you're looking for is an inner join. Ben Forta's "Teach Yourself SQL in
10 Minutes" is a good intro to SQL. 

SELECT  * 
FROM            (
                        [table 1] INNER JOIN [table 2] 
                        ON [table 1].pronunciation = [table 2].pronunciation
                ) INNER JOIN [table 3] 
                ON [table 1].meaning = [table 3].meaning

Generally speaking, each of your tables should use numeric, arbitrary
primary keys (such as autonumber fields). 

BTW the "EQ" operator is CFML. When you write a query you are writing SQL,
not CFML. The SQL operator is "=".

Matthew

-----Original Message-----
From: Roberto Perez [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 13 February 2005 4:31 a.m.
To: CF-Talk
Subject: On querying a TB with FK's

Hi all,

Quick question on queries: I have a "Table 1" with 2 foreign keys (FK) from 
two other tables, something like this:

Table 1:
word PK
pronunciation FK
meaning FK

Table 2:
pronunciation PK
word FK

Table 3:
meaning PK
word FK

So, if I query Table 1, will I get the values of "pronunciation" and 
"meaning" through the relation, or do I also have to query tables 2 and 3?

If this last case is true, would I have to query Table 1 first to get the 
value of "word", and then use to query the other two tables, with a 
statement like "Where Table2.word EQ Table1.word"?

I'm using CF 6 and MS Access 2000 (I know, I know, not the best DB, but 
that's all I have right now).

Thanks :-)

Roberto Perez
[EMAIL PROTECTED]




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194472
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to