Skip to content

Instantly share code, notes, and snippets.

@bluemango
Created November 19, 2011 03:24
Show Gist options
  • Save bluemango/1378383 to your computer and use it in GitHub Desktop.
Save bluemango/1378383 to your computer and use it in GitHub Desktop.
'SELECT `lessons`.`id` * 1 + 0 AS `id`,
`spaces`.`id` AS `published_space_id`
FROM lessons
LEFT JOIN readings on lessons.id = readings.lesson_id AND lessons.draft = 0
LEFT JOIN sections on readings.section_id = sections.id AND sections.hidden = 0
LEFT JOIN manuals on manuals.id = sections.manual_id AND manuals.draft = 0
LEFT JOIN assets_spaces as manual_assets ON manual_assets.asset_id = manuals.id AND manual_assets.asset_type = "Manual"
LEFT JOIN spaces ON manual_assets.space_id = spaces.id'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment