ÁppleAssassin
ÁppleAssassin

Reputation: 55

How to update a column name which is named after a date in SQL

UPDATE studentattendance
JOIN studentdetails using(matricno)
JOIN studentModules using (matricno)
SET 05/12/15 = 1
WHERE cardUid = '01545695'

Hey hows it going, I'm having trouble updating a column in my database, the column is called '05/12/15' because it's named after a date. However I'm having trouble updating it with SQL because the syntax is wrong.

How do I update it as it seems to be having trouble with the forward slashes. I've tried single quotes and square brackets but they don't work

Thanks

Upvotes: 1

Views: 28

Answers (1)

Abhishek Sharma
Abhishek Sharma

Reputation: 6661

Using backticks permits you to use alternative characters.

SET `05/12/15` = 1

query :-

UPDATE studentattendance
JOIN studentdetails using(matricno)
JOIN studentModules using (matricno)
SET `05/12/15` = 1
WHERE cardUid = '01545695'

Upvotes: 1

Related Questions