What to combine two tables into one.

0 votes
May 12 in Database by Nikola
• 140 points

recategorized May 12 by Gitika 108 views
Hey, @Nikola,

Could you please post your table pieces of information here?
Table 1 Table 2 Result
ID  Split Program ID  Split Program ID  Split Program
10010 15 420 10052 815 10010 15 420
10010 14 421 10054 815 10010 14 421
10010 15 422 10034 230 10010 15 422
10010 14 423 10360 421 10010 14 423
10010 14 424 10048 815 10010 14 424
10010 14 426 11030 815 10010 14 426
10010 14 427 51009 714 10010 14 427
10371 50 460 10040 441 10371 50 460
10371 50 222 10241 420 10371 50 222
10001 40 460 50552 711 10001 40 460
10001 35 470 11038 815 10001 35 470
10001 25 429 10178 230 10001 25 429
10308 50 222 50989 711 10308 50 222
10308 50 460 11036 815 10308 50 460
10342 60 558 10010 429 10342 60 558
10342 40 634 10338 230 10342 40 634
10032 95 815 10005 420 10032 95 815
10032 5 820 11020 415 10032 5 820
10298 50 632 50963 714 10298 50 632
10298 50 638 10900 423 10298 50 638
11016 429 10052 100 815
50748 711 10054 100 815
10345 421 10034 100 230
11009 815 10360 100 421
50819 711 10048 100 815
10371 815 11030 100 815
11010 635 51009 100 714
50993 714 10040 100 441
50988 711 10241 100 420
10074 465 50552 100 711
11032 815 11038 100 815
10832 712 10178 100 230
10878 230 50989 100 711
50805 711 11036 100 815
11003 711 10338 100 230
10884 224 10005 100 420
11023 635 11020 100 415
10055 815 50963 100 714
10002 421 10900 100 423
10038 441 11016 100 429
10881 221 50748 100 711
10060 441 10345 100 421
11018 418 11009 100 815
11011 421 50819 100 711
10192 226 11010 100 635
10892 429 50993 100 714
10050 815 50988 100 711
10890 815 10074 100 465
10001 429 11032 100 815
10041 815 10832 100 712
10887 441 10878 100 230
10363 420 50805 100 711
10068 815 11003 100 711
11037 422 10884 100 224
50987 711 11023 100 635
11001 815 10055 100 815
10329 426 10002 100 421
50724 711 10038 100 441
50969 714 10881 100 221
10061 426 10060 100 441
10308 222 11018 100 418
10342 558 11011 100 421
11035 815 10192 100 226
11025 227 10892 100 429
11006 712 10050 100 815
11002 815 10890 100 815
51012 711 10041 100 815
10808 635 10887 100 441
10348 422 10363 100 420
11015 413 10068 100 815
10853 422 11037 100 422
10073 815 50987 100 711
10863 714 11001 100 815
10032 815 10329 100 426
51015 711 50724 100 711
11017 417 50969 100 714
10309 441 10061 100 426
10035 636 11035 100 815
10870 424 11025 100 227
10483 423 11006 100 712
11027 418 11002 100 815
10028 426 51012 100 711
10876 424 10808 100 635
10025 230 10348 100 422
10044 460 11015 100 413
10003 421 10853 100 422
11007 221 10073 100 815
51002 712 10863 100 714
10298 632 51015 100 711
11005 230 11017 100 417
50965 711 10309 100 441
10869 558 10035 100 636
10057 815 10870 100 424
50984 711 10483 100 423
10399 424 11027 100 418
10373 424 10028 100 426
10868 636 10876 100 424
50743 714 10025 100 230
10204 230 10044 100 460
11021 419 10003 100 421
50665 711 11007 100 221
10067 815 51002 100 712
10116 427 11005 100 230
50845 711 50965 100 711
10140 422 10869 100 558
10364 423 10057 100 815
11034 815 50984 100 711
11028 815 10399 100 424
10367 460 10373 100 424
10337 635 10868 100 636
11033 815 50743 100 714
50683 711 10204 100 230
10024 230 11021 100 419
50835 711 50665 100 711
10889 222 10067 100 815
11031 815 10116 100 427
11019 416 50845 100 711
10286 558 10140 100 422
50964 711 10364 100 423
10069 815 11034 100 815
50810 711 11028 100 815
10043 815 10367 100 460
50555 711 10337 100 635
10039 711 11033 100 815
10866 423 50683 100 711
10495 426 10024 100 230
51016 711 50835 100 711
10368 465 10889 100 222
51005 711 11031 100 815
11012 441 11019 100 416
10752 226 10286 100 558
10201 230 50964 100 711
10737 714 10069 100 815
10885 460 50810 100 711
10013 420 10043 100 815
10879 427 50555 100 711
51014 711 10039 100 711
50997 711 10866 100 423
10065 815 10495 100 426
10046 420 51016 100 711
11029 815 10368 100 465
11014 414 51005 100 711
10011 815 11012 100 441
10301 230 10752 100 226
10179 711 10201 100 230
10571 712 10737 100 714
10427 423 10885 100 460
10664 712 10013 100 420
10883 230 10879 100 427
11024 419 51014 100 711
10317 230 50997 100 711
50994 711 10065 100 815
50798 711 10046 100 420
51004 712 11029 100 815
10897 634 11014 100 414
10491 221 10011 100 815
10071 422 10301 100 230
51013 712 10179 100 711
10571 100 712
10427 100 423
10664 100 712
10883 100 230
11024 100 419
10317 100 230
50994 100 711
50798 100 711
51004 100 712
10897 100 634
10491 100 221
10071 100 422
51013 100 712

1 answer to this question.

0 votes

Hii Nikola,

I think you need to UNION ALL otherwise you may not capture all the data; depends on what data is in the table (duplicates etc).

INSERT INTO new_table_name(Structure, Name, Active)
   SELECT * FROM table_1 
   UNION ALL
   SELECT * FROM table_2; 

Hope this will solve your problem!

answered May 21 by Niroj
• 58,500 points

Related Questions In Database

0 votes
2 answers

What are the ways to get the count of records in a table

With the help of the SQL count ...READ MORE

answered Aug 20 in Database by Okugbe
• 280 points
306 views
0 votes
1 answer

What is the SQL query to get the third highest salary of an employee from employee_table

You can try out something like this: SELECT ...READ MORE

answered Sep 26, 2018 in Database by Sahiti
• 6,320 points
1,933 views
0 votes
1 answer

What are the steps performed by Migration Wizard while migrating a database to MySQL?

The following are the steps  performed by ...READ MORE

answered Dec 10, 2018 in Database by Sahiti
• 6,320 points
161 views
0 votes
1 answer

What are the hardware requirements to install DB2 on Linux?

Hey @Kiran, DB2 Server is available for ...READ MORE

answered Mar 20, 2019 in Database by Kevin
119 views
0 votes
1 answer

What are the prerequisites to install PostgreSQL on Ubuntu?

Before you start installing postgreSQL, make sure ...READ MORE

answered Mar 22, 2019 in Database by Manoj
204 views
0 votes
1 answer

What is the best way to fetch data from table?

Hey Shraddha, I understand your doubts about fetching ...READ MORE

answered May 24, 2019 in Database by sampriti
• 1,100 points
378 views
0 votes
1 answer

What is the rule to use group by, having and where clause?

Hi samar, this is a very common mistake ...READ MORE

answered Jul 2, 2019 in Database by anonymous
240 views
+1 vote
1 answer

How to migrate a PostgreSQL database into a SQLServer one?

Hello @kartik, The easier way to accomplish this. First ...READ MORE

answered May 13 in Database by Niroj
• 58,500 points
77 views
0 votes
1 answer

How to detect a SQL table's existence in Java?

Hello, Depending on the DB, you can do ...READ MORE

answered May 13 in Database by Niroj
• 58,500 points
105 views