🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: DBGrid one more time ?

#3604
From: Vassiliev V.V.
Date: Thu, 18 Jul 2002 06:22
43 lines
2159 bytes
Use Join (Left join, right join, inner join) like

SELECT LName, FName, Name
FROM Person
LEFT JOIN PersonHistory ON Person.PersonID = PersonHistory.PersonID
LEFT JOIN Company ON PersonHistory.CompanyID = Company.CompanyID

Regards,
Vassiliev V.V.
http://www.oledbdirect.com

"Uros Obradovic" <ouros@hotmail.com> �������/�������� � �������� ���������:
news:3d35d23e$1_2@dnews...
> Hi guys,
> I'm having with DBGrid, actually I would say I don't know how to do
> following.
>
> In DBGrid control, I have 4 Columns
> - Last Name
> - First Name
> - Company Name
>
> where Last Name and First Name are from one table, and Company Name from
the
> other.
> Last Name and First Name columns are pointing to LName and FName fields in
> Person Table respectively,
> but Company Name is in the other table.
> I would like to use the following SQL statement and have the results in
> Company Name column.
>
> SELECT LName, FName, Name
> FROM Person, PersonHistory, Company
> WHERE Person.PersonID = PersonHistory.PersonID
> AND PersonHistory.CompanyID = Company.CompanyID
>
> How can I do that ?
> Hope you understand my question
>
> Thanks
> Uros
>
>
Technical Details
Message-ID: <3d36644f$1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!nntp.flash.net!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews
References: <3d35d23e$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,b0601243ddb1b151
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-07-18 00:12:17 PST
From: "Vassiliev V.V." <news@vassilievvv.mtu-net.ru>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3d35d23e$1_2@dnews>
Subject: Re: DBGrid one more time ? 
Date: Thu, 18 Jul 2002 10:22:42 +0400
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 62.118.138.232
Message-ID: <3d36644f$1_2@dnews>
X-Trace: dnews 1026974799 62.118.138.232 (17 Jul 2002 23:46:39 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!nntp.flash.net!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews