2

How can I do something like that

SELECT * WHERE owner = '81',

    owner = NULL

FROM outcome

or

UPDATE outcome SET NULL WHERE owner = '81'

So before request the table contains values 81 but after request corresponding values in NULL.

  • `UPDATE outcome SET owner = NULL WHERE owner = '81'` does exactly that. Is it something else you're looking for? Like a recordset of updated rows? – dwkd Feb 26 '15 at 21:10

2 Answers2

1

Assuming outcome is your table name, here is what you need:

UPDATE outcome 
SET owner = NULL 
WHERE owner = '81'

If you also want to select the updated rows see here:

OUTPUT Clause in MySQL

So... in MySQL that part seems a bit tricky.

Community
  • 1
  • 1
peter.petrov
  • 38,363
  • 16
  • 94
  • 159
1

Is this what you want?

SELECT * FROM OUTCOME WHERE (OWNER IS NULL OR OWNER='81')

UPDATE outcome SET owner=NULL 
WHERE owner = '81'
SoulTrain
  • 1,904
  • 1
  • 12
  • 11