No worries mate, I'm thinking it would need more abstraction to deal with i18n and things, but for basic English reports it's got some of what you might need.
You might be able to embed that dependant query with multiple ON parameters in the JOIN.. That is much faster! (Same fields selected, same data returned, 70k rows in 1.8s!)SELECT t.ticket_id,s.name, t.number as public_id, d.dept_name, sla.name, v.value as subject, v2.value as priority, u.name, IFNULL(CONCAT(staff.firstname, ' ', staff.lastname),'Unassigned') as Assigned_Staff, IFNULL(team.name,'') as Team, IFNULL(ht.topic,'') as TopicFROM `ot_form_entry_values` v LEFT JOIN `ot_form_entry_values` v2 ON v.entry_id = v2.entry_id AND v2.field_id = (SELECT id FROM `ot_form_field` WHERE name = 'priority')LEFT JOIN `ot_form_entry` e ON e.id = v.entry_idLEFT JOIN `ot_ticket` t ON e.object_id = t.ticket_id AND e.`object_id` = t.ticket_id AND e.`object_type` = 'T'LEFT JOIN `ot_ticket_status` s ON s.id = t.status_idLEFT JOIN `ot_department` d ON d.dept_id = t.dept_idLEFT JOIN `ot_sla` sla ON sla.id = d.sla_idLEFT JOIN `ot_help_topic` ht ON ht.topic_id = t.topic_idLEFT JOIN `ot_team` team ON team.team_id = t.team_idLEFT JOIN `ot_user` u ON u.id = t.user_idLEFT JOIN `ot_staff` staff ON staff.staff_id = t.staff_idWHERE v.field_id IN (SELECT id FROM `ot_form_field` WHERE name IN ('priority', 'state'))GROUP BY t.ticket_idORDER BY t.ticket_id DESCTo add your fields, you should edit the WHERE condition to reflect the fields you want to include, and then keep rejoining.. Modify SELECT Adding:v3.value as MyFieldColumnNameThen after the v2 JOIN:LEFT JOIN `ot_form_entry_values` v3 ON v.entry_id = v3.entry_id AND v3.field_id = (SELECT id FROM `ot_form_field` WHERE name = 'YourDbFieldIdentifier')Then in WHERE WHERE v.field_id IN (SELECT id FROM `ot_form_field` WHERE name IN ('priority','state','YourDbFieldIdentifier')Looks pretty good. You should be able to add as many fields as you want.The `name` is the backend version of the field that you set when you make one (so is language independant), or use one of the defaults: email,name,phone,notes,subject,message,priority,name,website,phone,address,name,address,phone,website,notes,state,description,While there appears to be duplicates, that's because the first name relates to form_id one "contact Information", the second is "Company Name" from form_id three, the third is Organization name from form_id 4.. Which you can imagine gets decoded by the ot_form_field table.