DiRAD
#1
HI all,
Can you please help me write me a statement, i know how to do it in SQL, but i don’t know how to do it in mysql through asterisk.
this is the statement
Select field1 from tablename where ({ fn NOW()} > datetime_variable + ‘10:00:00 am’)
thanks in advance.
DiRAD
#2
Just got it to work
exten => s,3,MYSQL(Query resultid ${connid}\ SELECT\ field1\ from\ TableName\ where\ DATE_FORMAT(curdate(),’%Y-%m-%d\ %h:%i:%s %p’ )>\ DATE_FORMAT(DATE_ADD(DateTimeFieldInTheDB,\ INTERVAL\ ‘10:00’\ HOUR_MINUTE),’%Y-%m-%d\ %h:%i:%s\ %p’)
What this thing saying: Is now > 10:00 am on the DateTimeFieldinTheDB. if yes, it will bring back the value in field1, if not, it will be null.
if you want to go the difficult way, create a PHP file, pass in the date, do y our caculation there and them pass the result out.
I hope that helps somebody.