When debugging an ORM call, you may find yourself collecting the SQL that will be exectued via the DataList::sql function - this is great, but when copied and pasted into e.g. PHPMyAdmin, MySQL Workbench, HeidiSQL, DBeaver, Sequel Pro, etc... it doesn't seem to work!
Lets look at an example query that might* be used for a template call such as <% if $Menu(1) %>:
SELECT DISTINCT count(DISTINCT "SiteTree_Live"."ID") AS "Count"
FROM "SiteTree_Live"
WHERE (("SiteTree_Live"."ParentID" = 0))