Skip to content

Instantly share code, notes, and snippets.

@davletyarov
Created May 24, 2019 16:22
Show Gist options
  • Save davletyarov/bb3b8eb4351f23241d794175eb6f2b6f to your computer and use it in GitHub Desktop.
Save davletyarov/bb3b8eb4351f23241d794175eb6f2b6f to your computer and use it in GitHub Desktop.
SELECT *
FROM category c
WHERE (SELECT count(*) FROM category s WHERE s.parent_category_id = c.id) BETWEEN 1 AND 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment