0

I have created a trigger like this:

create trigger mydb.t_count  after insert
on mydb.titles 
for each row 
update  mydb.authors set titles_count= 'titles_count'+1 where author_id=new.author_id;

While inserting a row in titles tables I am getting error stating

Truncated incorrect double value:titles_count

I think something has to be changed in update command. How to perform arithmetic operations in it? I need to increment the titles_count value (author table) by 1 whenever a row is inserted in titles table...

Gleb Kemarsky
  • 10,160
  • 7
  • 43
  • 68
R.Manjula
  • 11
  • 5
  • `update mydb.authors set titles_count= titles_count+1` There is no need for `'` – Lukasz Szozda Aug 31 '17 at 08:45
  • Possible duplicate of [When to use single quotes, double quotes, and backticks in MySQL](https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks-in-mysql) – Lukasz Szozda Aug 31 '17 at 08:46
  • Even when I remove the single quotes I am getting the same error ...Truncated incorrect double value:titles_count..while inserting a record in titles table.Thank you for helping – R.Manjula Sep 01 '17 at 09:17

0 Answers0