I have 3 tables: TABLEA (ID INT, name VARCHAR(2))
ID Name
01 A4
01 SH
01 9K
02 M1
02 L4
03 2G
03 99
TableB(Name VARCHAR(2))
Name
5G
U8
02
45
23
J7
99
9F
A4
H2....
TableC(ID INT, Name VARCHAR(2)) (prepopulated with ID from tableA) (same number of records as A)
ID Name
01 NULL
01 NULL
01 NULL
02 NULL
02 NULL
03 NULL
03 NULL
I want to populate C.Name from B.Name so that for same ID (say 1), it should have different values than A.Name . So, C.Name can not have (A4, SH, 9K) for ID = 1 because they already exist in A.name. Also, A.name may or maynot exist in B.name.
Problem here is that I dont have additional columns in tableB. Do I need more columns to JOIN my tables? Thanks for your help!
See Question&Answers more detail:os