It's been a while since i used MySQLWorkbench to make queries and i'm kinda lost here. I want to update a row in a table named last_export that refers the last time a specific app had access to the datas in the database. Each app has it's own row so their queries ( made with differents views) feed them the datas they 're missing since their last call.
I tried to make 2 statement in my view, it was like this :
VIEW my_view AS
SELECT
my_selected_info
FROM
(((my_1_table
JOIN 2_table ON ((1_id = 2_id1)))
JOIN 3_table ON ((2_id = 3_id2)))
JOIN last_export ON (((2_created > last_export_date)
OR (2_audited > last_export_date))));
UPDATE last_export SET last_export_date = DATE(NOW()) WHERE export_destination = my_app
But, every time i apply the change into the view, the UPDATE Statement disapear in the code of the view and the view update the last_export_date only one time before going back to only send the datas i want without updating last_export.
It's need to be said but i don't have the admin access to this base, i can only create view, tables and modify the datas inside, and this view is used in another database management tool (AikenWorkbench if it can help) to create another view from the datas of my view.
EDIT (08/07/2024) :
I have new informations :
1- I can't use anything else than a view for the starting point of all my actions (AikenWorkbench,the application that need the info from my select, use directly my view to get the informations needed)
2- I can't install module on the database since it's used by another application that 'owned' it and is very restrictive on what we're allowed to do with it.
3- I have the right to create and modify Function and Stored Procedures
I've tried a little on my own the Stored Procedure and Function but it didn't seems to work. I either could not apply the changes or it respond with an error : 'Error Code: 1442. Can't update table 'last_export' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.'
On another note, i find it weird that my first view work only one time, it should always work or not work in the first place. Seems odd to me, if someone have an explanation ?