Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
lesponce
Starting Member
8 Posts |
Posted - 2012-12-06 : 19:57:02
|
I need to update a field with value '1' on Table A, but I need to join to Table B to check if the customer that I'm going to update on table A, exists on Table B. If the customer does not exist on table B, then I can't update Table A.How do I do that?On Table A I'm going to set FLAG = '1'WHERE FLAG on TABLE A is NULL and Does exists on TABLE B |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-12-06 : 20:22:38
|
UPDATE aSET FLAG = '1'FROM tableA aWHERE EXISTS (select * from tableB b where a.customer = b.customer)AND FLAG is nullJimJimEveryday I learn something that somebody else already knew |
|
|
|
|
|