SQL query by supplier

Viewed 22

I'm new to SQL, looking for a query to "flag products for 'delete', by costkind, where PLU is identified."

Example

UPDATE PROD 
SET ChangeFlag = 'D'
WHERE costkind IN ('xxxx', 'xxxx')
WHERE plu IN ('xxxxxxxxxxxxxx')

I can't quite get the query correct,

Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'where'

Can anybody help me, please?

1 Answers

If you have multiple conditions for your WHERE clause, you need to combine them with OR or AND - not repeat WHERE.

Try this:

UPDATE PROD 
SET ChangeFlag = 'D'
WHERE costkind IN ('xxxx', 'xxxx')
  AND plu IN ('xxxxxxxxxxxxxx')
Related