🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #5291

Re: Any ideas of how to do one query that include more of one ADOTable? Can you help me...

#5291
From: Mark Cashman
Date: Fri, 15 Jun 2001 02:17
35 lines
2189 bytes
Hi, Jaime!

You can either...

1) Use a lookup field on one TADOTable that refers to fields in another
TADOTable or
2) Use a TADOQuery with a SELECT command that joins the two underlying
database tables.

To create a lookup field, double-click on the TADOTable, right button on
the fields editor window that appears, pick "New Field" and then create
the lookup field; set the field in the current table which is to be used
as the key to the other table, set the other table, and set which field
in the other table is the key, and which field in the other table is to
be returned.

To create a SQL SELECT command to join the two tables, follow the
pattern...

SELECT * FROM sometable,othertable WHERE sometable.otherID =
othertable.ID

Note that the table names in this command are not the names of two
TADOTable components, but are the names of underlying database tables.

I hope this helps.

------
Mark Cashman (TeamB - C++ Builder), creator of The Temporal Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------
Technical Details
Message-ID: <3B297036.68B7A5B3@temporaldoorway.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews
References: <3b28e891$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,4a7721c2ca7357b3
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-06-14 19:20:16 PST
Message-ID: <3B297036.68B7A5B3@temporaldoorway.com>
Date: Thu, 14 Jun 2001 22:17:27 -0400
From: Mark Cashman <mcashman@temporaldoorway.com>
Reply-To: mcashman@temporaldoorway.com
X-Mailer: Mozilla 4.77 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: Any ideas of how to do one query that include more of one ADOTable? 
 Can you help me...
References: <3b28e891$1_1@dnews>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 24.14.197.193
X-Trace: dnews 992571361 24.14.197.193 (14 Jun 2001 19:16:01 -0700)
Lines: 37
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews