Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Alias Query

Author  Topic 

teamjai
Yak Posting Veteran

52 Posts

Posted - 2013-12-04 : 01:06:54
The following SQL statement specifies two aliases, one for the CustomerName column and one for the ContactName

Query :
SELECT CustomerName AS Customer, ContactName AS ContactPerson
FROM Customers;

Customer ContactPerson
-------- ---------------
AAA BBB
CCC DDD

I need two alias name for single column.

Example

Customer1 Customer2
--------- -------------
AAA AAA
CCC CCC

is it possible in Sql Server? .Please help me.

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-12-04 : 01:20:42
yes

SELECT CustomerName AS Customer1, CustomerName AS Customer12
FROM Customers;



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-04 : 05:22:14
Cant think of a reason for this requirement though!

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -