Re: concatenating fields in an SQL query

From: Sunil Furtado (sunil_at_furtado.de)
Date: 02/18/05


Date: Fri, 18 Feb 2005 12:19:01 +0530

SELECT
  tblContacts.*,
  iif(isnull(tblContacts.FirstName,' ',tblContacts.FirstName) )+ ' ' + etc

Sunil

----- Original Message -----

> 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



Relevant Pages

  • Re: concatenating fields in an SQL query
    ... >> get a nieuw field ContactName to select in dropdownbox. ... >> If one of the 3 fields is empty i get an empty ContactName string back. ... >> FROM tblContacts ...
    (borland.public.delphi.database.ado)
  • Re: Help With SELECT Statement
    ... SELECT ContactName, SUM ... FROM tblContacts RIGHT JOIN tblInvoices ON tblContacts.ContactID = ... SumAS SumAmount ...
    (microsoft.public.sqlserver)
  • Re: Help With SELECT Statement
    ... > SELECT ContactName, SUM ... > FROM tblContacts RIGHT JOIN tblInvoices ON tblContacts.ContactID = ... > SumAS SumAmount ...
    (microsoft.public.sqlserver)
  • concatenating fields in an SQL query
    ... I'm trying to concatenate 3 fields: FirstName + MiddleName + LastName to get ... If one of the 3 fields is empty i get an empty ContactName string back. ... FROM tblContacts ... MiddleName, Text 10, Required = No, Allow Zero Length = Yes ...
    (borland.public.delphi.database.ado)
  • Re: How do I find duplicates in Access 2002 without the install cd-rom
    ... SELECT ContactName, Countas NumOf ... FROM tblContacts ... MS Access MVP ...
    (microsoft.public.access.queries)