Get Next Row Value in Current Row in Query (1 Viewer)

waqas ali

New member
Local time
Today, 08:50
Joined
Jan 8, 2017
Messages
2
dear experts,


how to write a query? i want if login is empty then it should take next max logout in NextTime column for current record.
if login is not empty then it should take max login to NextTime column as i mentioned in below table


LOGINLOGOUTNextTime03-Jan-17 06:57:2203-Jan-17 07:10:2203-Jan-17 07:10:2203-Jan-17 07:11:5503-Jan-17 07:11:5503-Jan-17 07:38:0003-Jan-17 07:38:0003-Jan-17 07:55:4703-Jan-17 07:55:4703-Jan-17 07:57:0103-Jan-17 07:57:0103-Jan-17 08:18:4303-Jan-17 08:18:4303-Jan-17 08:59:3803-Jan-17 08:59:3803-Jan-17 09:19:5603-Jan-17 09:19:5603-Jan-17 09:27:4003-Jan-17 09:27:4003-Jan-17 09:35:1603-Jan-17 09:29:1603-Jan-17 09:36:0603-Jan-17 09:44:0903-Jan-17 09:59:1803-Jan-17 10:10:08
 
Last edited:

NauticalGent

Ignore List Poster Boy
Local time
Today, 00:50
Joined
Apr 27, 2015
Messages
6,396
Are you trying record when people logon to your application?
 

sneuberg

AWF VIP
Local time
Yesterday, 21:50
Joined
Oct 17, 2014
Messages
3,506
I suggest posting your example data within code tags which displays in a fixed-width font (usually Courier), and it preserves both spaces and line breaks. To do this you will need to click Go Advanced, enter your data, select it, and click on the pound sign (#) in the menu bar. Below is an example of this with my guess of what your data looks like

Code:
LOGIN                   LOGOUT                NextTime
03-Jan-17 06:57:22	03-Jan-17 07:10:22	03-Jan-17 07:10:22
03-Jan-17 07:11:55	03-Jan-17 07:11:55	03-Jan-17 07:38:00
03-Jan-17 07:38:00	03-Jan-17 07:55:47	03-Jan-17 07:55:47
03-Jan-17 07:57:01	03-Jan-17 07:57:01	03-Jan-17 08:18:43
03-Jan-17 08:18:43	03-Jan-17 08:59:38	03-Jan-17 08:59:38
03-Jan-17 09:19:56	03-Jan-17 09:19:56	03-Jan-17 09:27:40
03-Jan-17 09:27:40	03-Jan-17 09:35:16	03-Jan-17 09:29:16
03-Jan-17 09:36:06	03-Jan-17 09:44:09	03-Jan-17 09:59:18
03-Jan-17 10:10:08

Also please give us examples of with inputs with desired results.
 
Last edited:

Users who are viewing this thread

Top Bottom