SHARE
TWEET

Untitled

a guest Nov 14th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT        MasterName.Last+ ', ' + MasterName.First+ ', '
  2.               +MasterName.Middle AS NameCombined, MasterName.Type,
  3.               JailIntake.Booking_Status, JailIntake.Intake_Date,
  4.               JailIntake.Agency, MasterDescriptors.DOB, JailCharge.Suffix_1,
  5.               JailCharge.Charge_Literal, JailIntake.Incident_Nr,
  6.               JailCharge.Bond_Amount, Pictures.UnitID, ct500.code,
  7.               Pictures.IType
  8.  
  9. FROM          RMS.dbo.MasterName AS MasterName INNER JOIN
  10.               RMS.dbo.MasterDescriptors AS MasterDescriptors ON
  11.               MasterName.Suffix_1 = MasterDescriptors.Suffix_1 AND
  12.               MasterName.Incident_Nr = MasterDescriptors.Incident_Nr AND
  13.               MasterName.Agency = MasterDescriptors.Agency AND
  14.               MasterName.Module_ID = MasterDescriptors.Module_ID INNER JOIN
  15.               RMS.dbo.JailIntake AS JailIntake ON
  16.               MasterDescriptors.Module_ID = JailIntake.Module_ID AND
  17.               MasterDescriptors.Incident_Nr = JailIntake.Incident_Nr AND
  18.               MasterDescriptors.Agency = JailIntake.Agency AND
  19.               MasterDescriptors.Suffix_1 = JailIntake.Suffix_1 INNER JOIN
  20.               RMS.dbo.JailCharge AS JailCharge ON JailIntake.Incident_Nr =
  21.               JailCharge.Incident_Nr AND JailIntake.Agency =
  22.               JailCharge.Agency AND JailIntake.Module_ID =
  23.               JailCharge.Module_ID INNER JOIN
  24.               IMAGES.dbo.Pictures ON JailIntake.Incident_Nr =
  25.               JailCharge.Incident_Nr AND 'ABBV^' + JailIntake.Incident_Nr +
  26.               '^^^^INT^IN^MNI^' = Pictures.UnitID INNER JOIN
  27.               PIMSTABL.dbo.ct500 AS ct500 ON ct500.code =
  28.               JailIntake.Inmate_Type
  29. WHERE         (MasterName.Type = 'IN') AND (JailIntake.Booking_Status = 'IJ'
  30.               OR JailIntake.Booking_Status = 'OF') AND
  31.               (JailIntake.Agency = 'ABBV') AND (Pictures.IType = '1106')
  32.  
  33. ORDER BY      MasterName.Last
  34.    
  35. NAME OF PERSON       CHARGENUMBER     CHARGEDESCRIPTION
  36.  
  37. Doe, Jane                001               TEXT
  38. Doe, Jane                002               TEXT
  39. Doe, Jane                003               TEXT
  40. Johnson, John            001               TEXT
  41. Johnson, John            002               TEXT
  42. Thompson, Tommy          001               TEXT
  43. Williams, Wendy          001               TEXT
  44. Williams, Wendy          002               TEXT
  45.    
  46. NAME OF PERSON       CHARGENUMBER          CHARGEDESCRIPTION
  47.  
  48. Doe, Jane            001, 002, 003         TEXT, TEXT, TEXT
  49. Johnson, John          001, 002                TEXT, TEXT
  50. Thompson, Tommy          001                      TEXT
  51. Williams, Wendy        001, 002                TEXT, TEXT
RAW Paste Data
Top