Useful SQL Queries

Last modified: April 27, 2021
You are here:
Estimated reading time: < 1 min

We want to share Some useful SQL Queries which we use often related to Migrations, Assistance or other Reason.

Most Used Services

This SQL Queries show your most used Service within the last 150 Days and with Count Information

We use this Query for Migrations or to determine which Services have not been used anymore.

select count(s.Name) as Count, s.Name from Requests as R inner join Services as S on R.ServiceId = S.Id
where r.StartTime  > dateadd(DAY, -150, getdate())
group by
order by count desc

Get all Services with specific Question Type

That SQL Query gives you a list of all Services with a specific Question type.

This example shows all Service with a SQL Question Type

select Name, Text as Question  from Services as S
inner join RunbookParameterMappings as RPM on
where RunbookParameterType = '7'

Was this article helpful?
Dislike 0