Subject RE: [firebird-support] How do I write this query
Author Louis Kleiman
OK, I'll jump in:



SELECT *

FROM TableA A

JOIN TableB B ON (B.ForeignKey = A.Key)

JOIN TableC C ON ((C.ForeignKey = B.Key)

AND (C.FieldToMatch = MatchValue))



You could also put the (C.FieldToMatch = MatchValue) phrase in a WHERE
clause, but some optimizations work better if you put these conditions in
with the JOIN clauses.



Hope this helps.



Louis Kleiman

SSTMS, Inc.



_____

From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Grant Brown
Sent: Thursday, June 02, 2005 8:46 AM
To: Firbird Support Group
Subject: [firebird-support] How do I write this query



Hi everyone,

Could some one help me write the following SQL query, once I see the
basics I will be on my way.

I have 3 tables set up as such

Table A <<<>>> Table B<<< >>> Table C

Table B is the detail Table of A where Table A is the master table

Table C is the detail Table of B where Table B is the master table

ie all 3 tables are related

I need to find all records in Table A where the record in Table C = a value

TIA

--
Regards,
Grant Brown

Product Development Manager
Phone : 02 4229 1185
Mobile : 0412 926 995
Email : grant@...
Web : www.sitedoc.com.au

SiteDoc - Easy to Use - Powerful Results



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





_____

Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>

* Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.



[Non-text portions of this message have been removed]