Last active
April 15, 2021 20:04
-
-
Save codejake/0cb3b74e57a72b9fa00c86e4f0e07cda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select a.* from ( | |
select | |
[id], | |
[User_Name], | |
[Client_IP_Address], | |
[Called_Station_Id], | |
[Packet_Type], | |
[Reason-Code], | |
LAG([Calling_Station_ID],1) OVER( PARTITION BY [User_Name] ORDER BY [User_Name]) client FROM [NPSODBC].[dbo].[accounting_data] WHERE [Reason-Code] != 0 | |
) a | |
ORDER BY [id] DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment