?
Solved

Help With SQL Select

Posted on 2007-12-05
4
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 10

Accepted Solution

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

Assisted Solution

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

Assisted Solution

by:Limbeck
Limbeck earned 400 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

777 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