Click here to Skip to main content
16,018,294 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
ID                                     EMAIL
_____________________________________________
EMAIL01                         xxx.xxx
EMAIL01A                      @xxx.com


Please help me to merge these two rows to create an email like this: xxx.xxx@xxx.com as a single row.
Posted
Updated 25-Feb-13 5:24am
v3
Comments
joshrduncan2012 25-Feb-13 9:21am    
What have you tried so far to accomplish this task?
[no name] 25-Feb-13 9:57am    
Have you tried "EMAIL01 + EMAIL01A"?
ZurdoDev 25-Feb-13 10:08am    
As suggested, just concatenate them together into a single row. Where exactly are you stuck?

There is not enough information in the question to understand why a database table would be designed this way and what other rows are in the table that might need to be selected in a similar manner. Nevertheless, below is a Microsoft SQL Server SELECT statement that will concatenate the two rows in the manner that you specified in your question to create an email address.

Select (Select RTRIM(EMAIL) from table_1 where ID='EMAIL01') + (Select RTRIM(EMAIL) from table_1 where ID='EMAIL01A')


Note: Tested using Microsoft SQL Server Management Studio on SQL Server Express 2012
 
Share this answer
 
select (select ltrim(rtrim(Email)) from urTable where id='Email01') + (select ltrim(rtrim(Email)) from urTable where id='Email01A')
use this query
 
Share this answer
 
Suppose your table is "THE_TABLE":


SQL
SELECT T1.ID, T1.EMAIL + T2.EMAIL FROM THE_TABLE T1 
  JOIN THE_TABLE T2 
     ON T2.ID = (T1.ID + 'A')


That should work ;)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900