Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you considered outputing the query as XML? I am not sure what RDBMS you are using, but a SQL-Server example would be:</p> <pre><code>CREATE TABLE #IncidentReport(id INT, startTime DATETIME, endTime DATETIME, leadAgent VARCHAR(20)) CREATE TABLE #IRCameras(incidentId INT, camId INT, camName VARCHAR(50), camLocation VARCHAR(50)) CREATE TABLE #IRNotes(incidentId INT, operatorName VARCHAR(50), operatorId INT, noteText VARCHAR(50)) CREATE TABLE #IRGroupsAssigned(incidentId INT, groupId INT, groupName VARCHAR(50)) CREATE TABLE #IRWidgetsUsed(incidentId INT, widgetId INT, widgetName VARCHAR(50), widgetUse VARCHAR(50)) INSERT #IncidentReport VALUES (1, GETDATE()-2, GETDATE()-1, 'Joe'), (2, GETDATE(), GETDATE()+1, 'Karen') INSERT #IRCameras VALUES (1, 1, 'Camera1', 'Office #123'), (1, 2, 'Camera2', 'Outer Space'), (2, 345, 'Camera3', 'Office #2323'), (2, 12, 'Jane''s Cam', 'Inner Space') INSERT #IRNotes VALUES (1, 'Sam', 1234, 'I said Hello to the Customer'), (1, 'Joe', 322, 'Good Job'), (2, 'Jeff', 32323, 'How is the case going') INSERT #IRGroupsAssigned VALUES (1, 222, 'Red Team'), (1, 223, 'Blue Team'), (1, 224, 'Yellow Team'), (2, 222, 'Red Team') INSERT #IRWidgetsUsed VALUES (1, 123, 'A widget', 'Tightened'), (1, 122, 'Another widget', 'Loosened'), (2, 223, 'Super widget', 'Unknown') SELECT ID, StartTime, EndTime, LeadAgent, ( SELECT CamID, CamName, CamLocation FROM #IRCameras c WHERE ir.ID = c.IncidentID FOR XML PATH('Cameras'), TYPE ), ( SELECT OperatorName, OperatorID, NoteText FROM #IRNotes n WHERE ir.ID = n.IncidentID FOR XML PATH('Notes'), TYPE ), ( SELECT GroupID, GroupName FROM #IRGroupsAssigned g WHERE ir.ID = g.IncidentID FOR XML PATH('GroupsAssigned'), TYPE ), ( SELECT WidgetID, WidgetName, WidgetUse FROM #IRWidgetsUsed w WHERE ir.ID = w.IncidentID FOR XML PATH('WidgetsUsed'), TYPE ) FROM #IncidentReport IR FOR XML PATH ('IncidentReport'), ROOT DROP TABLE #IncidentReport DROP TABLE #IRCameras DROP TABLE #IRNotes DROP TABLE #IRGroupsAssigned DROP TABLE #IRWidgetsUsed </code></pre> <p>Not sure if you can apply any of this logic to your situation but it has been 7 hours and nobody has posted any other ideas so thought I would throw this out there.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload