Jeroen Bellemans Jeroen Bellemans - 1 year ago 81
SQL Question

Update query does not update row(s)

I'm struggling with a very basic query. I can not see what I'm doing wrong.

Here is the first query I tried:

UPDATE `qrm_logs` SET `billable` = '0' AND `invoice_id` = NULL WHERE `id` = '842'

And the second:

UPDATE `qrm_logs` SET `billable` = 0 AND `invoice_id` IS NULL WHERE `id` = '842'

has type
. Column
is an
type. Also, invoice_id can be nullable.

What causes this problem?

Answer Source

Should be:

UPDATE `qrm_logs` SET `billable` = 0, `invoice_id` = NULL WHERE `id` = 842

note the comma instead of the AND.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download