Jump to content

Using SQL Functions in Reports?


Stephen Weiler

Recommended Posts

I've developed a Direct SQL query that gives me what I need, but I can't find a way to use this / replicate this in Reports / in some method others can run. Can we use SQL functions in Reports?

My Direct SQL is below. The measures I'm looking for are in bold font. Can I get these same results using Reports?

select 
    h_pk_reference TicketNumber,
    h_summary Summary,
    h_fk_priorityname priority,
    h_ownername owner,
    IF(h_ownername = h_lastmodifiedusername, 'Yes','No') LastUpdatedByOwner,
    h_datelogged LogDate,
    h_datelastmodified lastmodified,
    TIMESTAMPDIFF(HOUR,h_datelastmodified,CURRENT_TIMESTAMP()) AS HoursSinceUpdate,
    ROUND(TIMESTAMPDIFF(HOUR,h_datelastmodified, CURRENT_TIMESTAMP())/24,0) AS DaysSinceUpdate,

    h_lastmodifiedusername lastmodifiedby,
    h_status status
from h_itsm_requests
where h_status not in('status.closed','status.resolved','status.cancelled')
limit 1000

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...