Skip to content

Instantly share code, notes, and snippets.

@jschroed91
Created November 13, 2014 18:19
Show Gist options
  • Save jschroed91/f9019f22fb96d3c9df4f to your computer and use it in GitHub Desktop.
Save jschroed91/f9019f22fb96d3c9df4f to your computer and use it in GitHub Desktop.
SELECT s.id, s.title, s.number, c.content as main_content, c2.content as exception, c3.content as list_content, c4.content as exception_list, c5.content as list_list_content FROM cdp_section s
INNER JOIN cdp_section_content sc
ON sc.section_id = s.id
INNER JOIN cdp_content c ON c.id = sc.content_id
LEFT JOIN cdp_content c2 ON c2.id = c.exception_id
LEFT JOIN cdp_lists l ON l.id = c.content_list_id
LEFT JOIN cdp_lists_list_items lli on lli.list_id = l.id
LEFT JOIN cdp_list_items li on li.id = lli.list_item_id
LEFT JOIN cdp_list_items_content lic on lic.list_item_id = li.id
LEFT JOIN cdp_content c3 on c3.id = lic.content_id
LEFT JOIN cdp_lists l3 ON l3.id = c3.content_list_id
LEFT JOIN cdp_lists_list_items lli3 on lli3.list_id = l3.id
LEFT JOIN cdp_list_items li3 on li3.id = lli3.list_item_id
LEFT JOIN cdp_list_items_content lic3 on lic3.list_item_id = li3.id
LEFT JOIN cdp_content c5 on c5.id = lic3.content_id
LEFT JOIN cdp_lists l2 ON l2.id = c2.content_list_id
LEFT JOIN cdp_lists_list_items lli2 on lli2.list_id = l2.id
LEFT JOIN cdp_list_items li2 on li2.id = lli2.list_item_id
LEFT JOIN cdp_list_items_content lic2 on lic2.list_item_id = li2.id
LEFT JOIN cdp_content c4 on c4.id = lic2.content_id
-- WHERE s.title = 'Type L vent.'
WHERE s.number = 'G2409.4.3';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment