Maintenance Record Database Query

Back to Database Queries

         
        SELECT
          "institution"."name",                   -- anonymized name of institution
          "machine"."id",                         -- anonymized name of machine
          "machineType"."model",                  -- type of machine
          "multileafCollimator"."model",          -- HD or Millenium
          "maintenanceRecord"."creationTime",     -- date and time that event occurred
          "user"."id",                            -- user that created maintenence event
          "maintenanceRecord"."category",         -- event classification
          "maintenanceRecord"."summary",          -- event summary
          "maintenanceRecord"."description"       -- event description
		FROM
          public."maintenanceRecord",
          public."institution",
          public."machine",
          public."machineType",
          public."multileafCollimator",
          public."user"
        WHERE
              ("machine"."machinePK" = "maintenanceRecord"."machinePK")
          AND ("machine"."institutionPK" = "institution"."institutionPK")
          AND ("machine"."machineTypePK" = "machineType"."machineTypePK")
          AND ("machine"."multileafCollimatorPK" = "multileafCollimator"."multileafCollimatorPK")
          AND ("user"."userPK" = "maintenanceRecord"."userPK")
        ORDER BY
          "institution"."name",
          "machine"."id",
          "maintenanceRecord"."creationTime"
        ASC LIMIT 10;  -- limit to first 10 entries