Thursday, March 8, 2012

Compare data and add to table

Hi all,

Newbie here. I was wondering if any of you gurus could answer a question for me. Here is what I need to do (and I stress need):

I have 2 tables.

Table A has 3 columns, column 1 is unique customer numbers, column 2 is ticket numbers, column 3 is empty records.

Table B has 2 columns, column 1 is unique customer numbers (same numbers, although not the same order as Table A) , column 2 is invoice numbers.

I need to compare Table A where records in column 1 match records in column 1 in Table B. Where the records do match, I need to copy the records from Table B, column 2 to Table A column 3.

Can anyone here help me with this, please? It would really get me out of a jam with this, since it is the last step I have to take to finally get this new app rolled out.

Thanks a lot.

MarkSome app, huh?!

update a set Column3 = b.Column2
from TableA a
inner join TableB b
on a.Column1 = b.Column1|||Thank you, thank you, thank you.

As you can see, I am in not a DB admin, nor do I have the resources on had to find the solution to this problem. (or I would have RTFM) Thanks lots, you have relieved me of quite a bit of stress. Thanks again.

I'd buy you a beer if I could.

Mark|||Heineken, please ;)

No comments:

Post a Comment