0

Somewhat new to SQL. Cannot seem to figure out what i'm doing wrong!!

UPDATE mileagetable 
SET EndMileage= `4599`, 
    EndTime= `9 : 12 AM` 
WHERE mileagetable.id= 26

Basically i have a db called lets say db83838383 and a table in that db called mileagetable And 30 records identified by the primary key " id " I'm just trying to open a currently existent record "26" and fill in two empty feilds.

I cannot seem to get my query to work? Any help would be appreciated.

Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390
  • you shouldn't need backticks for your integer or your time. those look like strings so you should just use apostrophe. – user1477388 Apr 10 '14 at 14:19
  • single `' '` u should be using instead of `` – Abhik Chakraborty Apr 10 '14 at 14:19
  • Change the backticks (``) to normal quotes (`'`). Also, I don't know what the type of `EndTime` is but if it is a `TIMESTAMP` o r something like that, it may not like `9 : 12 AM`. – CompuChip Apr 10 '14 at 14:20
  • possible duplicate of [When to use single quotes, double quotes, and backticks?](http://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks) – Michael Berkowski Apr 10 '14 at 14:22

1 Answers1

3

Ticks are for identifiers. Quotes are for string values:

UPDATE mileagetable 
SET EndMileage= `4599`, 
    EndTime= `9 : 12 AM` 
WHERE mileagetable.id= 26

should be

UPDATE mileagetable 
SET EndMileage= '4599', 
    EndTime= '9 : 12 AM' 
WHERE mileagetable.id= 26
John Conde
  • 217,595
  • 99
  • 455
  • 496