View Single Post
Old 04-09-2009, 03:34 PM   #1 (permalink)
webosb
The Contributor
 
webosb's Avatar
 
Join Date: Nov 2007
Posts: 41
Thanks: 24
webosb is on a distinguished road
Default I need help with a query to get the amount of minutes from DATETIME

So I have a column called "signupdate" that is a datetime datatype. And I want to be able to get the elapsed time it took between signups of a user with the same ip address. I never formulated datetime datatypes before, can anyone offer any assistance?

say if i had rows of data as so:

ipaddress|signupdate
10.10.1.100|2009-04-08 22:20:01
10.10.1.100|2009-04-08 22:23:12
10.10.1.100|2009-04-08 22:24:30
10.10.1.100|2009-04-08 22:25:32
10.10.1.100|2009-04-08 22:26:16


SELECT (FORMULA TO GET ELAPSED TIME [HIGHEST VAL - LOWEST VAL])
FROM users
WHERE ipaddress = "10.10.1.100"

Basically to do this and output 6 minutes:
22:26:16 - 22:20:01 = 6:15

I'm getting stuck on how to get the highest value and lowest value from the 5 rows of data
I
__________________
"Things you can get access to, you should never memorize." -Albert Einstein
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
webosb is offline  
Reply With Quote