jma4227
11/21/2019 - 1:57 PM

SQL Queries

SQL Queries

SELECT
								GTask__Id,
								GTask__TaskNumber,
								GTask__StatusG,
								GTask__Type1G,
								GTask__TaskAssignedToRId,
								GTask__TaskAssignedToRId_L,
					
						
		           				GOccurrence__UCRClearanceStatusG__0
		                              
								
							FROM GTask
								LEFT JOIN (TaskSubjectGOccurrence
									LEFT JOIN GOccurrence 
									)
						WHERE GTask.TaskAssignedToRId = 150025010000000032998302
						AND EXISTS ( 
							SELECT GOccurrence.Id
								FROM TaskSubjectGOccurrence
									LEFT JOIN (GOccurrence
										LEFT JOIN CFSOccurrence)
							WHERE TaskSubjectGOccurrence.LId = GTask.Id
							AND CFSOccurrence.UCRClearanceStatus = 'C03'
						)
SELECT 
	Occurrence.Id,
	Occurrence.ACCDomain,
	Occurrence.ESAreaLevel3G,
	Occurrence.UCRClearanceStatus,
	GOccInvGPerson.LabelRight,
	GTask.Type1G(0)
	
FROM Occurrence
						LEFT JOIN (USStatsClassification
							LEFT JOIN USStatsClassificationOffense
						)
						LEFT JOIN (TaskSubjectGOccurrence
							LEFT JOIN ( GTask 
								LEFT JOIN TaskAssignedTo )
						)
						LEFT JOIN NIBRSIncident
						LEFT JOIN (GOccInvGPerson
							LEFT JOIN Person Officer
						)
						LEFT JOIN (GOccIvPA
							LEFT JOIN PhysicalAddress
						) ON GOccIvPA.IsESAreaLevelSource = 1
WHERE Occurrence.ESAreaLevel3G = 'D20'
AND GOccInvGPerson.RId = 150025010000000032998302
SELECT TaskAssignedTo.Id, 
		GTask.StatusG, 
		GTask.TaskAssignedToRId_L,
		GTask.LastLogEntry,
		
		TaskAssocWorkflowNode.Id AS 'TaskWorkflow Id', 
		WorkflowNode.Id AS 'Workflow Node Id',
		WorkflowNode.Title, 
		WorkflowNode.TaskType,
		WorkflowNode.AssignTo,
		WorkflowNode.WFAssignedToWFNodeId,
		OrgResponsibleOfficerRId

FROM OrgPoliceUnit
	LEFT JOIN (TaskAssignedTo
		LEFT JOIN (GTask 
			LEFT JOIN (TaskAssocWorkflowNode
				LEFT JOIN WorkflowNode)
				
			)
		)
WHERE OrgPoliceUnit.Id = 141025010000000032516484
ORDER BY TaskAssocWorkflowNode.Id DESC, GTask.StatusG ASC
SELECT gocc.Id
FROM GOccurrence gocc
	LEFT JOIN (Occurrence occ)
	LEFT JOIN (GPersonCharge GPC)
 WHERE gocc.OccurrenceFileNo = 'BCS180007959'
	<!--Officer and Unit By Task Assignment -->
					SELECT
						Officer__Id,
						Officer__LabelEmpl,
						
						GTask__Id,
						OrgPoliceUnit__Id,
						OrgPoliceUnit__LabelEmpl
						
						From TaskAssignedTo
							LEFT JOIN GTask
							LEFT JOIN (Person Officer
								LEFT JOIN (GPersonOrgMemberGPerson
									LEFT JOIN OrgPoliceUnit ON OrgPoliceUnit.Id = GPersonOrgMemberGPerson.LId
									) ON GPersonOrgMemberGPerson.RId = Officer.Id
								AND GPersonOrgMemberGPerson.IsEffectiveAssignment = 1
							)
					<xsl:value-of select="$TaskWhereClause" />
					AND HierarchicalResult = 1
SELECT GPPW.Id, GPPW.IdNumber, GPersonName.Gender
FROM GPersonPolGenericLegalDoc GPPLD
	LEFT JOIN (GPPLDAccusedGPerson AGP
		LEFT JOIN (GPerson
			LEFT JOIN (GPersonName)
			LEFT JOIN (GPersonArrest GPA)
			LEFT JOIN (GPersonPolWarrant GPPW)
		)
	)
WHERE GPerson.Id = 150025010000000046044702
	
SELECT GPA__Id, GPerson.Id, GPerson__Given1_cache, GPA__GPCCustAddressRID_L, GPA__GPCCustOfficer1RId_L
FROM GPersonArrest GPA
	left join (GPCCustAddress
		left join (PhysicalAddress GPAPA)
	)
	left join (GPerson
		left join (Person
			left join (GPersonName)
			left join (PersonDesc)
			left join (PersonInfo)
		)
	)
Where GPA.Id = 120625010000000046045473