Vote count:
0
I want to get the min and max difference between two different time columns from my database but I'm not sure what function I am supposed to use to do this. I spent some time looking online and found something called timediff which I thought would work but apparently it doesn't exist. What function should I be using to carry out this statement? I made an attempt using timediff which doesn't work but should help anyone understand what I am trying to do.
SELECT EMPLOYEEID, COUNT(ORDER_TYPE) AS TYPECOUNT, MIN(TIMEDIFF(ORDER_ACCEPTED_TIME,ORDER_COMPLETION_TIME)) AS MINPREP, MAX(TIMEDIFF(ORDER_ACCEPTED_TIME, ORDER_COMPLETION_TIME)) AS MAXPREP FROM ORDERS WHERE ORDERDATE BETWEEN '4/01/2015' AND '4/30/2015' AND ORDER_TYPE ='Breakfast' GROUP BY EMPLOYEEID
The above is the statement that I tried previously using the timediff method which doesn't work in my program. In addition, I am writing this code in java and am using jdbc connectivity and therefore am trying to write this statement into a string which gets passed as a statement later on
asked 31 secs ago
Compare two time data types in sql
Aucun commentaire:
Enregistrer un commentaire