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 |
|
msenthilrajanmca
Starting Member
3 Posts |
Posted - 2008-05-23 : 09:45:43
|
| Hi, I have 2 tables called Table A, Table B,In Table A i am having Data1, Data2 like 2 datas in Column 1In Table B i am having Data2, Data3 Like 2 datas in Column 1Now want a output like Data1,Data2,Data3Please help me to get this....Thank you,Senthil |
|
|
pootle_flump
1064 Posts |
Posted - 2008-05-23 : 09:51:39
|
| Check out this SQL tutorial. In particular you will want to use UNION (ALL)Oops - posting the link helps eh?http://www.w3schools.com/sql/default.asp |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-23 : 10:04:26
|
[code]-- Prepare sample dataDECLARE @TableA TABLE (Col1 VARCHAR(20))INSERT @TableASELECT 'Data1, Data2'DECLARE @TableB TABLE (Col1 VARCHAR(20))INSERT @TableBSELECT 'Data2, Data3'-- Show the expected outputSELECT LTRIM(RTRIM(x.Data)) AS theValueFROM @TableA AS aCROSS APPLY dbo.fnParseList(',', Col1) AS xUNIONSELECT LTRIM(RTRIM(x.Data)) AS theValueFROM @TableB AS bCROSS APPLY dbo.fnParseList(',', Col1) AS x[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
pootle_flump
1064 Posts |
Posted - 2008-05-23 : 10:33:29
|
Oh - two datums in one column. Sorry Sentil - I misunderstood. You realise of course that you could do with changing the design if you can? |
 |
|
|
msenthilrajanmca
Starting Member
3 Posts |
Posted - 2008-05-24 : 01:27:12
|
| Thank you friends |
 |
|
|
|
|
|
|
|