An example of a query we use rawSql connection for...
# orm-help
c
An example of a query we use rawSql connection for instead of prisma client.
Copy code
// Get a list of controls and the most recent status
SELECT c.*,
FROM controls AS c
LEFT JOIN control_status AS cs ON cs.control_id = c.control_id
WHERE
   cs.csid = (
      SELECT MAX(updatedDate)
      FROM control_status
      WHERE control_id = c.control_id
   )