| Author |
Topic |
|
CoolMoon2011
Starting Member
31 Posts |
Posted - 2012-01-10 : 10:59:38
|
| I have two table (1000+ rows each) with the same structure. I want to put them together. Anyone would like to help me out for this issue? I list a sample for what I want to get in the combined table.Thank you ahead here!Table 1:groupcode runtypeFCPOOL_R_C EVFCPOOL_R_C EV Table 2: groupcode runtype1_TX_C_N Run1_OK_C_N RunI want to combine them like below: groupcode runtypeFCPOOL_R_C EVFCPOOL_R_C EV1_TX_C_N Run1_OK_C_N Nun |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-10 : 11:12:45
|
| [code]SELECT groupcode,runtypeFROM table1UNION ALLSELECT groupcode,runtypeFROM table2[/code]use UNION if you want distinct set of values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-10 : 11:14:43
|
create MyNewTable(groupcode varchar(30), runtype varchar(30))insert MyNewTableselect groupcode, runtype from MyOldTable1union allselect groupcode, runtype from MyOldTable2 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
CoolMoon2011
Starting Member
31 Posts |
Posted - 2012-01-10 : 11:20:40
|
quote: Originally posted by visakh16
SELECT groupcode,runtypeFROM table1UNION ALLSELECT groupcode,runtypeFROM table2 use UNION if you want distinct set of values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
 |
|
|
CoolMoon2011
Starting Member
31 Posts |
Posted - 2012-01-10 : 11:22:20
|
| I really appreciate for your great ideas. Thanks all experts here. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-10 : 11:27:15
|
| did it work?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
CoolMoon2011
Starting Member
31 Posts |
Posted - 2012-01-10 : 11:54:43
|
| yup. It works well. I use union to distinct them. Thank you visakh16.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/[/quote] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-10 : 11:57:20
|
quote: Originally posted by CoolMoon2011 yup. It works well. I use union to distinct them. Thank you visakh16.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
[/quote]you're welcome ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|