Help, I have 3 identical tables with similar data, now I want to create a 4th table with only unique data from all the 3 tables. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help, I have 3 identical tables with similar data, now I want to create a 4th table with only unique data from all the 3 tables.

6th Sep 2017, 2:21 PM
TRonZ
TRonZ - avatar
8 Answers
+ 8
but why , it will not work
6th Sep 2017, 3:28 PM
Changed
Changed - avatar
+ 7
use foreign key for connecting tables ... and put primary key on those columns on which u r applying foreign k. to connect tables
6th Sep 2017, 2:34 PM
Changed
Changed - avatar
+ 2
use Distinct keyword
6th Sep 2017, 2:26 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 2
SELECT DISTINCT (COL_NAME) FROM TABLE(S) NAME
6th Sep 2017, 2:27 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
@sahu I need to do it with all the three combined together.
6th Sep 2017, 2:32 PM
TRonZ
TRonZ - avatar
+ 1
@sahu I don't want distinct from each table itself but unique data from each table.
6th Sep 2017, 2:33 PM
TRonZ
TRonZ - avatar
+ 1
@Gaurav that will not work.
6th Sep 2017, 2:44 PM
TRonZ
TRonZ - avatar
+ 1
@Gaurav the three tables were originally installed on 3 separate machines, then they were imported into a single database, therefore they have no common key.
6th Sep 2017, 3:36 PM
TRonZ
TRonZ - avatar