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.
| Author |
Topic |
|
amsad
Starting Member
17 Posts |
Posted - 2011-02-17 : 23:37:12
|
| Hi guys,I need to combine result with 3 column,Example; no_id |file_seq_no | group_name |alert_no | 1 3060 die70 0001 2 3061 die70 0001 3 3062 die70 0002i want to select and create like this output, no_id | new_column | 1 die70_3060_0001 2 die70_3061_0001 3 die70_3062_0002Appreciate if you can help me.Thanks Can do. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-02-17 : 23:43:54
|
[code]select new_column = group_name + convert(varchar(10),file_seq_no) + alert_no[/code]assuming that file_seq_no is a numeric column KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Ranjit.ileni
Posting Yak Master
183 Posts |
Posted - 2011-02-18 : 00:30:46
|
| Try this...create table #temp(no_id int,file_seq_no int,group_name varchar(10),alert_no varchar(10))goinsert #tempselect 1,3060,'die70','0001' union allselect 2,3061,'die70','0001' union allselect 3,3062,'die70','0002'goselect no_id,new_column = group_name +'_'+ convert(varchar(10),file_seq_no) +'_'+ alert_nofrom #temp--Ranjit |
 |
|
|
amsad
Starting Member
17 Posts |
Posted - 2011-02-18 : 01:46:35
|
| Hi, I already try on this,its done!Thank you guys....Can do. |
 |
|
|
|
|
|
|
|