🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: SQL SELECT -- Combine 2 columns

#2590
From: Viatcheslav V. Vassiliev
Date: Sun, 20 Apr 2003 07:41
68 lines
3113 bytes
What error do you have? Note that Name is special keyword and use:

Select [Name], ([City] + ', ' + [Country]) as [Location] from [tblIndy]

If City or Country is not string column, use

Select [Name], (CStr([City]) + ', ' + CStr([Country])) as [Location] from
[tblIndy]

If this does not help, install latest MDAC and Jet SP.

----------------------------------------------------------------
Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to access MS SQL Server, MS Jet (MS Access)
and Interbase (through OLEDB) databases.

"Rainer Welzel" <rainer@fgg-welzel.de> �������/�������� � ��������
���������: news:3ea23628@newsgroups.borland.com...
> This doesn't works.
> I use Jet 4.0
> with a ADOQuery and a DBGrid.
>
> rainer
>
> "Viatcheslav V. Vassiliev" <support@oledbdirect.com> schrieb im
Newsbeitrag
> news:3ea14f97@newsgroups.borland.com...
> > This depends on your DBMS. In MS SQL Server use (pubs db):
> >
> > Select (au_lname + ', ' + au_fname) as [name] from authors
> >
> > ----------------------------------------------------------------
> > Regards,
> > Viatcheslav V. Vassiliev
> > http://www.oledbdirect.com
> > The fastest way to access MS SQL Server, MS Jet (MS Access)
> > and Interbase (through OLEDB) databases.
> >
> > "Rainer Welzel" <rainer@fgg-welzel.de> �������/�������� � ��������
> > ���������: news:3ea14b69@newsgroups.borland.com...
> > > Hi ,
> > > I failed to combine 2 fields  with the following statement:
> > >
> > > ADOQueryIND->SQL->Add("SELECT Name, City & ', ' & Country AS Location
> FROM
> > > tblIndi");
> > >
> > > also
> > >
> > > ADOQueryIND->SQL->Add("SELECT Name, City || ', ' || Country AS
Location
> > FROM
> > > tblIndi");
> > >
> > > this statement failed.
> > >
> > > Have anybody the right syntax ??
> > >
> > > thx rainer
> > >
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <3ea24fdc@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c03.atl99!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3ea14b69@newsgroups.borland.com> <3ea14f97@newsgroups.borland.com> <3ea23628@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,2ea9fd8801400070
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-04-20 00:52:48 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3ea14b69@newsgroups.borland.com> <3ea14f97@newsgroups.borland.com> <3ea23628@newsgroups.borland.com>
Subject: Re: SQL SELECT -- Combine 2 columns
Date: Sun, 20 Apr 2003 11:41:29 +0400
Lines: 70
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.247.201.57
Message-ID: <3ea24fdc@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1050824668 213.247.201.57 (20 Apr 2003 00:44:28 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c03.atl99!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail