Table of Contents

Conventions - General Report Writing

Author: Michelle McCausland


Commenting


SQL Fields


Table Joins

Joining Hubs and their children

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"

Joining tickets to ticket statuses

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  

Joining tickets to ticket changes to pick specific forms

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.


Query Criteria


Grouping & Ordering


Working with Time

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,

Report Writing Gotchas

Please consult the following page for more info. on report writing guidelines based on previous experience of reports:

Report Writing Gotchas


Saving your work

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.


What is a NODE - **Extenet Specific**

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')