select statement [message #371853] |
Thu, 14 December 2000 02:00 |
jimmy
Messages: 21 Registered: November 2000
|
Junior Member |
|
|
Hi there,
I'm wondering if I can display two columns as one from a select statement, like this:
I have a table containing user data. There are some columns in that table and two columns are LASTNAME and FIRSTNAME. When I make my select statement I would like to do something like;
select (lastname + ' ' + firstname) as name, userid from user;
The result should be like:
name userid
--------------------------
Smith John 1
Smith Susan 2
Thanks in advance!
//Jimmy
|
|
|
|
Re: select statement [message #371855 is a reply to message #371853] |
Thu, 14 December 2000 02:24 |
Tittom
Messages: 15 Registered: November 2000
|
Junior Member |
|
|
You should use one of these :
- select field1 || field2 as name, id from your_table
where || is a concatenate operator.
OR
- select concat(field1, field2) as name from your_table
where concat is a concatenate function.
I hope this will help you
Tittom
|
|
|