Hi All,
I am getting an error when running the following SQL command in a group:
SELECT TimeDiff((SELECT EndTime FROM Table WHERE Table_ndx = 10),
(SELECT BeginTime FROM Table WHERE Table_ndx = 10))
The message states that " Error executing query: You have an error in your SQL Syntax; check the manual that corresponds to your MySql server version for the right syntax to use near ‘:22:07)’ at line 1"
(The time difference is 22min 07sec)
Any Ideas?
thanks,
Adam
Yikes, I don’t know why you’re getting that error, but that query is bizarre.
Try:
SELECT TimeDiff(EndTime, BeginTime) FROM Table WHERE Table_ndx = 10
Might want to pick up a copy of this book:
amazon.com/Learning-SQL-Alan … 231&sr=8-2
Funny part is, I get the proper result in the “value” portion of the group. I get the error message after that.
Is the action item writing back to a column? What type is the column?
Yes I am writing to a column. The type is DATETIME.
I will be onsite tomorrow, and I have a few things to try. I will let you know how I make out…
Thanks,
Adam
Try setting the action item’s data type to DATE. Sounds like the error may be coming from FactorySQL treating the value as a string.
If you can’t get it to work like that, try setting the type to String, and changing your query to something like the following:
SELECT Date_Format(TimeDiff(EndTime, BeginTime), '%Y-%m-%e %T') FROM Table WHERE Table_ndx = 10
I don’t expect this would be necessary, but basically what it’s doing is having the query return a string that is properly formatted to be sent directly to the database.
Hope this helps,