/t5/coldfusion-discussions/sql-statement-simple/m-p/863920#M79659Oct 08, 2008
Oct 08, 2008
Copy link to clipboard
Copied
simbull wrote:
> Hi, I know this is simple but I'm being a bit thick
>
> I have these two columns (firstname, lastname) in the
same table, I would like
> to join them and call it wholeName.
>
> So I thought it was this "SELECT firstname, lastname AS
wholeName FROM table"
>
> but it doesn't work.....am I not correct?
>
> Cheers in advance
>
No you are not correct. You need a concatenation character in
there.
What character that is will depend on your database. Here are
two very
common ones || and +
I.E.
SELECT firstname || lastname AS wholeName
OR
SELECT firstname + lastname AS wholeName
If this is for display purposes you may want to also
concatenate a space
character ' ' into your result.