sql query beteem two times (merged) [message #301153] |
Tue, 19 February 2008 06:06  |
tannad
Messages: 43 Registered: January 2008 Location: mumbai
|
Member |
|
|
Hi all Suppose my table is as follows.
Activitytime Person Flag
9:00 AM RaJ 0
9:10 AM RAj 1
9:45 Am RAj 1
9:50AM '' 0
9:55Am ,, 1
How I get the total duration between two time or two flag?
As
start_time stop_time Duration
9:00AM 9:45Am 45 min
|
|
|
Re: sql query beteem two times [message #301156 is a reply to message #301153] |
Tue, 19 February 2008 06:14   |
nagaa
Messages: 33 Registered: August 2007 Location: chennai
|
Member |
|
|
call the time function before start and end of the function..
Ex:
call_time("print current time")
insert()
{
------------insert statement here-------
}
call_time("print current Time")
Regards,
Nagaa
|
|
|
|
|
Re: sql query beteem two times [message #301289 is a reply to message #301153] |
Tue, 19 February 2008 23:59   |
tannad
Messages: 43 Registered: January 2008 Location: mumbai
|
Member |
|
|
my table is TEST
as follows
Activity_ time user flag
9:00 harshal 1
9:10 harshal 1
9:15 harshal 1
9:45 harshal 0
10:00 patil 1
10:10 patil 1
10:15 patil 0
when the flag 1 activity start and when the flag 0 activity stop
output will be in this manner
Starttime stoptime user Duration
9:00 9:45 harshal 45 min
10:00 10:15 patil 15min
please can you explain mi what will be the sql query for this
|
|
|
Re: sql for time duration [message #301298 is a reply to message #301153] |
Wed, 20 February 2008 00:22   |
 |
Michel Cadot
Messages: 68737 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Same answer as your previous topic, have a look at LAG function.
I merge the 2.
"when the flag 1 activity start" but when there are several flag=1 then activity starts several times?
You have to post a test case: create table and insert statements.
Also post the result you want with these data.
You also have to read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code and align the columns in result.
Use the "Preview Message" button to verify.
Regards
Michel
[Updated on: Wed, 20 February 2008 00:26] Report message to a moderator
|
|
|
|
|