Hi…
I have datetime data in my table kanban_data field chemicalweighing_dateEntry.
sample data of chemicalweighing_dateEntry:
2012-03-20 08:12:55
2012-03-20 08:16:44
2012-03-20 08:19:28
2012-03-20 08:20:17
2012-03-20 08:27:52
2012-03-20 08:28:36
2012-03-20 08:29:03
2012-03-20 08:31:47
2012-03-20 08:32:24
2012-03-20 08:35:45
I need to get the aging of chemicalweighing_dateEntry.
using this formula:
Aging time (00:00:00) = now() - SUM of chemicalweighing_dateEntry.
I don’t know what mysql function should I used to get the aging time.
Thank you
r937
2
try this –
SELECT SEC_TO_TIME(
TIME_TO_SEC( CURRENT_TIMESTAMP ) -
TIME_TO_SEC( SUM(chemicalweighing_dateEntry) )
) AS aging_time
that would make perfect sense if only it were possible to sum datetimes!!! (hint: it isn’t)
just what exactly does “sum of chemicalweighing_dateEntry” actually mean?
I tried it:
SELECT SEC_TO_TIME(
TIME_TO_SEC( CURRENT_TIMESTAMP ) -
TIME_TO_SEC( SUM(chemicalweighing_dateEntry) )
) AS aging_time FROM kanban_data;
the output display is: NULL
Thank you
I mean total of chemicalweighing_dateEntry.
Thank you
I tried this:
SELECT sec_to_time((SUM(time_to_sec(chemicalweighing_dateEntry))) - TIME_TO_SEC (NOW())) FROM kanban_data;
I’m not sure if my output : 95:24:15 is correct.
Thank you
r937
7
just what exactly does “sum of chemicalweighing_dateEntry” actually mean?
HINT: YOU CAN’T ADD DATETIMES
Yes,
I just want to know if my query is correct.
Thank you
What’s wrong in my query?
Thank you
r937
11
the fact that you’re trying to sum datetimes
if this farce is to continue, i insist that you explain what it means to sum datetimes
I need to sum the times and minus in now().
so what query should I need?
Thanks
r937
13
i think you need to step away from the computer for a day or so…