concatenating fields in an SQL query
From: Willy Verbiest (willy.verbiest_at_Advantra_No_Spam.com)
Date: 02/17/05
- Previous message: Guillem: "Re: Sorting and unsorting"
- Next in thread: Sunil Furtado: "Re: concatenating fields in an SQL query"
- Reply: Sunil Furtado: "Re: concatenating fields in an SQL query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 17 Feb 2005 16:39:22 +0100
I'm trying to concatenate 3 fields: FirstName + MiddleName + LastName to get
a nieuw field ContactName to select in dropdownbox.
If one of the 3 fields is empty i get an empty ContactName string back.
Here is the SQL
SELECT
tblContacts.*,
tblContacts.FirstName + ' ' +
tblContacts.MiddleName + ' ' +
tblContacts.LastName as ContactName
FROM tblContacts
WHERE tblContacts.CustomerID = :CustomerID
ORDER BY LastName, FirstName
I'm working with MsAccess db and Delphi 6 and ADO
In access I have defined the fields as follow:
FirstName, Text 10, Required = No, Allow Zero Length = Yes
MiddleName, Text 10, Required = No, Allow Zero Length = Yes
LastName, Text 10, Required = Yes, Allow Zero Length = No
Thanks in advance,
Willy
- Previous message: Guillem: "Re: Sorting and unsorting"
- Next in thread: Sunil Furtado: "Re: concatenating fields in an SQL query"
- Reply: Sunil Furtado: "Re: concatenating fields in an SQL query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|