Author: Michelle McCausland
# THIS IS A COMMENT at the start of the line to denote it is a comment/* THIS IS A COMMENT */SELECT t.id, t.name, t.summary should adhere to the customer's specifications per the report spec doct.id AS ticketId myFieldName, thisIsMyFieldName
For reference only - should not be blindly copy & pasted into report.
network_element hub LEFT JOIN network_element child on child.parent_id = hub.id AND hub.ne_type = "Controller"
For reference only - should not be blindly copy & pasted into report.
ticket AS t JOIN ticket_status st ON st.id = t.current_status_id
For reference only - should not be blindly copy & pasted into report.
JOIN ticket_change tc ON tc.id = (SELECT max(id) FROM ticket_change WHERE ticket_id = t.id AND contents LIKE 'Your Form%') JOIN f_form_table AS noc ON (tc.id = noc.change_id)
Be aware that a ticket can have more than one of a form attached i.e. Tickets with multiple dispatches will have multiple dispatch forms etc. This should be factored into your query.
WHERE t.closed_date IS NULL AND t.id = 3 Should be used to refine the SQL query to:
When working with time in relation to tickets it is important to specify dates in the following way:
AND t.create_date >= "${startDate} 00:00"
AND t.create_date <= "${endDate} 23:59"
DATE_FORMAT(t.create_date, '%m/%d/%Y') createdDate,
Please consult the following page for more info. on report writing guidelines based on previous experience of reports:
Important Note: As you work with SQL queries on a frequent basis, it becomes very useful to save common queries that you use into an evernote note or similar to refer back to when you are in a hurry.
When referring to a node in an SQL report the following conventions should be followed:
show_in_monitor = TRUE
network_identifier <> 'n/a'
carrier.name <> 'ORPHANS'
technology NOT IN( 'SENSAPHONE', 'VoltServer', 'Alpha', 'Small Cell')
ne_type IN ('Node')
Recommendation:
Create a new label, to refer to the larger set of equipment, including Extension Units, UPS, Sensaphone, VoltServer, Alpha, etc. This may be something like “Total Devices” This should be defined as follows:
show_in_monitor = TRUE
network_identifier <> 'n/a'
carrier.name <> 'ORPHANS'
ne_type IN ('Node’, 'Extension Unit','mNET','Small Cell','UPS','WIFI')