Mysql
select aas.session_id "SessionID", aal.name "User Name",aau.FIRST_NAME "Contact Name",org.NAME "Account Name", aas.user_host "User Host", aas.application_host "Application Host", longtodate(aas.opentime) "Start Time", longtodate(aas.closetime) "End Time", aas.status "Status" from AaaAccSession aas left join aaalogin aal on aas.account_id=aal.login_id left join sduser sd on aal.user_id=sd.userid left join departmentuser depu on sd.userid=depu.userid left join aaauser aau on depu.userid=aau.user_id LEFT JOIN Customer_Requester custreq ON sd.USERID=custreq.REQUESTER_ID LEFT JOIN Customer cust ON custreq.CUSTOMER_ID=cust.CUSTOMER_ID LEFT JOIN AaaOrganization org ON cust.CUSTOMER_ID=org.ORG_ID where (depu.USERTYPE = 'Contact') group by aas.session_id
pgsql
select aas.session_id "SessionID", aal.name "User Name",aau.FIRST_NAME "Contact Name",org.NAME "Account Name", aas.user_host "User Host", aas.application_host "Application Host", longtodate(aas.opentime) "Start Time", longtodate(aas.closetime) "End Time", aas.status "Status" from AaaAccSession aas left join aaalogin aal on aas.account_id=aal.login_id left join sduser sd on aal.user_id=sd.userid left join departmentuser depu on sd.userid=depu.userid left join aaauser aau on depu.userid=aau.user_id LEFT JOIN Customer_Requester custreq ON sd.USERID=custreq.REQUESTER_ID LEFT JOIN Customer cust ON custreq.CUSTOMER_ID=cust.CUSTOMER_ID LEFT JOIN AaaOrganization org ON cust.CUSTOMER_ID=org.ORG_ID where (depu.USERTYPE = 'Contact') group by aas.session_id,aal.name,aau.first_name,org.name
MSSQL
select aas.session_id "SessionID", aal.name "User Name",aau.FIRST_NAME "Contact Name",org.NAME "Account Name", aas.user_host "User Host", aas.application_host "Application Host", dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (aas.opentime/1000),'1970-01-01 00:00:00') "Start Time", dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (aas.closetime/1000),'1970-01-01 00:00:00') "End Time", aas.status "Status" from AaaAccSession aas left join aaalogin aal on aas.account_id=aal.login_id left join sduser sd on aal.user_id=sd.userid left join departmentuser depu on sd.userid=depu.userid left join aaauser aau on depu.userid=aau.user_id LEFT JOIN Customer_Requester custreq ON sd.USERID=custreq.REQUESTER_ID LEFT JOIN Customer cust ON custreq.CUSTOMER_ID=cust.CUSTOMER_ID LEFT JOIN AaaOrganization org ON cust.CUSTOMER_ID=org.ORG_ID where (depu.USERTYPE = 'Contact') group by aas.session_id,aal.name,aau.first_name,org.name,aas.user_host,aas.application_host,aas.opentime,aas.closetime,aas.status