On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

DQL to query user activity

Hi All,

I need assistance with a DQL query that is not working. I'm trying to obtain information on how many users are accessing the system, and if the systems is being access i would need their account names. What i have below is giving me the error that you see. Please let me know if you need more information, thanks.

DQL:

select count(*) from dm_user u
where r_is_group=0
and user_state=0
and exists (select 'x' from dm_group where group_name='etmf_pra_staff' and any i_all_users_names=u.user_name)
and user_name not in ('dm_dbo','admindm','dmadmindev','admindmtest','migrationAdmin','PortalMan')
and user_name not like 'dm_%'
and user_name not like '%client%'
and date(today)-last_login_utc_time>150
go

Error:

Error occured during query execution :[DM_QUERY_E_SYNTAX]error: "A Parser Error (syntax error) has occurred in the vicinity of: select count(*) from dm_user u
where r_is_group=0
and user_state=0
and exists (select 'x' from dm_group where group_name='etmf_pra_staff' and any i_all_users_names=u.user_name)
and user_name not in ('dm_dbo','admindm','dmadmindev','admindmtest','migrationAdmin','PortalMan')
and user_name not like 'dm_%'
and user_name not like '%client%'
and date(today)-last_login_utc_time>150
go"