I want to query from a table the row with the latest dtRequestToLog, to get the column strUniqueID. Compare the strUniqueID with an IF Statement, if that is equal to number X, then update in the same row blnAcceptedToLog = 1
So to get the row with the latest dtRequestToLog i use:
select strUniqueID from tblmainmonitor t where dtRequestToLog >= (now() - interval 30 minute ) AND idxBedrijf = 1 order by dtRequestToLog asc limit 1
This works fine. I have the following if statement that works as well:
DELIMITER $
CREATE PROCEDURE pr()
BEGIN
IF 3 = 3 THEN
SELECT 'TRUE';
ELSE
SELECT 'FALSE';
END IF;
END $
DELIMITER ;
CALL pr;
So instead of 3 = 3, i want to use the first query, the return value of it compare it to number x, i put in the query dynamicly from code; But when I put the query after 'IF' it would not work, nor with braces.
Then if the statement is true; I would like to use the same found row to update blnAcceptedLog to 1;
How do I do this?
Aucun commentaire:
Enregistrer un commentaire