Update query for database

97 Views Asked by At

What's wrong with my SQL update? I'm trying to update records with the upcoming value for status records with the value as missed & due_date BETWEEN 2020-08-01 AND 2020-12-31.

Where is the Syntax error?

UPDATE
  records
SET
  status = upcoming,
WHERE
  status = ‘ missed ’ & due_date BETWEEN 2020 -08 -01
  AND  2020 -12 -31 ;
1

There are 1 best solutions below

0
On BEST ANSWER

I think this should be written as:

UPDATE records
   SET status = 'upcoming'
   WHERE status = 'missed' AND
         due_date BETWEEN '2020-08-01' AND  '2020-12-31';

Notes:

  • Strings should be in single quotes.
  • Dates should be in single quotes.
  • SQL uses AND not & for boolean AND.