Mysql update and send e-mail

I tried to make scenario about probably easy job, but I can´t to do it. Coud You help me please? I want to find change (updated) rows in mysql database and send e-mail about this changes. I connect to my database - no problem. I send e-mail - no problem. BUT, how can I make, that I will find out only updated rows in database and send only this information? I´m spent long time for it and no success. Could You write me, or make some tutorial for to do it, please? Thank You so much. Have a nice day. Vita

It can be done, but I need to check a few things and see if it is there in your database to work. I will share you based on my assumption that you have some sort of updatedAt(updated_at or any column that denotes that the rows in MySQL have been updated) column in your MySQL table. If it exists then, What you want to do is,

  1. Create a New Scenario scheduled to run every X Minutes
  2. First Module, Will be Execute a Query(advanced), Whereby you will need to write a SQL query that will return rows that were updated between now and the last time the scenario was executed. So, Something like this, select * from your_table where updated_at > addMinutes(now;-15), whereby 15 will be the value of your scenario execution interval.
  3. Afterwhich, you can put the Send Email Module

Please do let me know if this clears your confusion.

1 Like

Hello, there is error “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘;-15)’ at line 1”.

Can you share with me how you are writing the query? addMinutes is a function in Make.

1 Like

wow, I understand. I change it, and now it looks like ok. Im going to test it and give result. Thank You so much for this moment. Vita

I have some mistake anywhere. Everything is ok, but e-mail is sending again and again and again. It seems to be like doesn´t work with last edit column in database.

I maked it propably. Problem was in date and time format. I have 2 hours diference, I´m from Czech so its not -15 but -105 :grinning:
I hope that´s all. I will test it again.

1 Like