MS Sql Select Query

garethtnash
garethtnash used Ask the Experts™
on
Hello Again Experts,

I've got a query below, however the JBCAFirstName column is a new addition, and in some instances there will be no value, I've tried to overcome this by LTRIM to remove spaces, however when I run the query against a record that i know has no value in the JBCAFirstName column but a value in the JBACANamecolumn, it returns nothing for the Name column?

Anyway around this?

Many thanks
SELECT JBACAID, JBACAUsername, LTRIM( Lower(JBCAFirstName +' '+ JBACAName)) As Name 
FROM dbo.JBACandidate
WHERE JBACAID = MMColParam

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SELECT JBACAID, JBACAUsername, LTRIM( Lower(isnull(JBCAFirstName,'') +' '+ JBACAName)) As Name
FROM dbo.JBACandidate
WHERE JBACAID = MMColParam
or may be this one:



SELECT JBACAID, JBACAUsername, LTRIM( Lower(isnull(JBCAFirstName,'') +' '+ isnull(JBACAName,''))) As Name 
FROM dbo.JBACandidate
WHERE JBACAID = MMColParam

Open in new window

Author

Commented:
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial