This topic is locked

SQL update statement

12/3/2006 6:07:00 PM
ASPRunnerPro General questions
hanb author

I am trying to create a sql statement to update a record set when a certain condition is true. example:

table A contains username (key), status

table B contains username (key), number1, number2
update should do something like this:

update B set B.number1, B.number2 (values 1, 1) when A.username = B.username and A.status = "MED"
I have tried all sort of combination of joins but all fail. Can anyone give me a correct SQL statement?

Sergey Kornilov admin 12/6/2006

Han,
something lik this will work:

Update B set Field1=Value1, Field2=Value2

where username in (select username from A where status = 'MED')