Home » RDBMS Server » Server Administration » select statement
select statement [message #371853] Thu, 14 December 2000 02:00 Go to next message
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 #371854 is a reply to message #371853] Thu, 14 December 2000 02:19 Go to previous messageGo to next message
Johnny A
Messages: 2
Registered: December 2000
Junior Member
Hey Jimmy, How's it going?

You would do it like this:

select lastname||' '||firstname name,userid
from user ;

All the best!
Johnny A
Re: select statement [message #371855 is a reply to message #371853] Thu, 14 December 2000 02:24 Go to previous message
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
Previous Topic: How to use this procedure..?
Next Topic: PL/SQL custom report ttitle word wrap...how to
Goto Forum:
  


Current Time: Sun Dec 22 20:19:36 CST 2024