View: dbo.User_Session_View
View definition
`create view dbo.User_Session_View as select US.user_session_guid , US.staff_KEY , USP.user_name , USP.host_name , USP.privilege_data , USP.client_application_name , USP.server_application_name , US.login_date , coalesce(USO.logout_date, US.logout_date) as logout_date , US.expiration_date , coalesce(USO.last_access_date, US.last_access_date) as last_access_date , coalesce(USO.user_session_status_KEY, US.user_session_status_KEY) as user_session_status_KEY , US.user_session_pattern_guid , PU.must_change_password , USP.windows_user_name from dbo.User_Session as US with (nolock) left outer join ( select USO.user_session_guid , max(USO.last_access_date) as last_access_date , max(USO.logout_date) as logout_date , max(USO.user_session_status_KEY) as user_session_status_KEY from dbo.User_Session_Override as USO with (nolock) group by USO.user_session_guid ) as USO on US.user_session_guid = USO.user_session_guid left outer join dbo.Practice_User as PU with (nolock) on PU.staff_KEY = US.staff_KEY left outer join dbo.User_Session_Pattern as USP with (nolock) on USP.user_session_pattern_guid = US.user_session_pattern_guid`