Ok, I have to concatenate two fields together Author and SecondAuthor.
SecondAuthor some times has blank values in it.

What I have so far is (thanks Hatton)

SELECT LTrim(Rtrim(IsNull(Author, ' ') + '; ' + IsNull(secondAuthor, ' ')))
AS
Authors
FROM table

Now the only question is if a book only has one author how do I not have the
";" after the Author.

Yes, I know I should break the Authors off into a related table but, that is
not in the scope of the project.

Thanks

Mark W. Breneman
-Macromedia Certified ColdFusion 5 Developer
-Network / Web Server Administrator
  Vivid Media
  [EMAIL PROTECTED]
  www.vividmedia.com
  608.270.9770

-----Original Message-----
From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 3:32 PM
To: CF-Talk
Subject: RE: concatenate blank fields in access and SQL


> Is there a way to concatenate two fields in access when one of them are
> blank?
>
> Select Title + ' '+ subtitle as fulltitle
> from table
>
> Fulltitle is blank when ether field is blank.
>
> Does any one know if this works in SQL server 7.

Is SQL server adding a NULL field to anything turns the entire statement to
NULL

Use the IsNull function to get around this:

SELECT LTrim(Rtrim(IsNull(Title, ' ') + ' ' + IsNull(Subtitle, ' '))) AS
fulltitle
FROM table

This should return the recordset you're looking for.

Hatton

______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to