me8042 0 Newbie Poster

Hi all,
I have 2 tables.i.e. Table1 and Table2.

Table1
---------------
Code
---------------
a_b
c_d
e_f
f_g

Table2
------------
Msg
------------
s_c_d_1
r_a_b_o
t_f_g_k
A_e_f_D

I want to compare the two columns of the respective Tables and get the output as..

Table2
----------------------
Msg || Code
---------------------
s_c_d_1 || c_d
r_a_b_o || a_b
t_f_g_k || f_g
A_e_f_D || e_f

That is i want to check which code is for which Msg and then update the Table2.code column.

I tried to implement this by...

UPDATE Table2.Code SET Table2.Code =(SELECT Table1.Code, Table2.Msg FROM Table1, Table2 WHERE Table1.Code LIKE Table2.Msg);

I even tried by

UPDATE Table2.Code SET Table2.Code =(SELECT Table1.Code, Table2.Msg FROM Table1, Table2 WHERE Table1.Code LIKE "'%' + Table2.Msg + '%'");

But still its not working...

Please guide me in this....
Thanking you!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.