Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Latest commit

 

History

History
12 lines (10 loc) · 338 Bytes

QUERIES.md

File metadata and controls

12 lines (10 loc) · 338 Bytes

SQL Queries

Number of entities by type

SELECT t.`name`, count(*)
  FROM entity e LEFT JOIN type t ON e.`type_id` = t.`id` WHERE 	e.instance_id = 1
  AND e.type_id IN (1, 2, 3, 4, 5, 6, 7, 8, 40, 49)
  AND e.current_revision_id IS NOT NULL
  AND e.id NOT IN (SELECT id FROM uuid where trashed = 1)
  GROUP BY e.`type_id`