Solved

Help With SQL Select

Posted on 2007-12-05
4
214 Views
Last Modified: 2010-04-21
Experts,

I'm writing a SQL select statement for a report and have a few requirements that I must meet.

I need to select from my orders table the First and Last name of the user

Table: Orders
Column: FirstName
Column: LastName

BUT I need to select them as one column in the result set, "Name". So my select would give me something like,

::Name::
FirstName + " " + LastName

Is this possible? If so, how would I form the SQL?

Thanks so much for your help!

~ C
0
Comment
Question by:clickclickbang
4 Comments
 
LVL 10

Accepted Solution

by:
answer_me earned 200 total points
ID: 20411203
Select Isnull(FirstName,'') + '  ' + isnull(LastName,'') as '::Name::' from Orders
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 200 total points
ID: 20411220
select FirstName + ' ' + LastName as Full_Name from orders
0
 
LVL 19

Assisted Solution

by:Limbeck
Limbeck earned 100 total points
ID: 20411281
unless you use firebird, than it would be

select FirstName || ' ' || LastName as Full_Name from orders
0
 
LVL 1

Author Closing Comment

by:clickclickbang
ID: 31412835
Thanks for the quick response, didn't know it was that easy!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question