Created
July 11, 2013 16:00
-
-
Save AmyStephen/5976751 to your computer and use it in GitHub Desktop.
Joomla Core Query withOUT contact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT a.id, a.title, a.alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, | |
CASE WHEN a.modified = '0000-00-00 00:00:00' THEN a.created ELSE a.modified END AS modified, a.modified_by, uam.name AS modified_by_name, | |
CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END AS publish_up,a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, LENGTH(a.fulltext) AS readmore, | |
CASE WHEN badcats.id IS NOT NULL THEN 0 ELSE a.state END AS state,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias, | |
CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email, parent.title AS parent_title, parent.id AS parent_id, parent.path AS parent_route, parent.alias AS parent_alias,ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count AS rating_count,c.published, | |
CASE WHEN badcats.id IS NULL THEN c.published ELSE 0 END AS parents_published | |
FROM w0z9v_content AS a | |
LEFT JOIN w0z9v_content_frontpage AS fp | |
ON fp.content_id = a.id | |
LEFT JOIN w0z9v_categories AS c | |
ON c.id = a.catid | |
LEFT JOIN w0z9v_users AS ua | |
ON ua.id = a.created_by | |
LEFT JOIN w0z9v_users AS uam | |
ON uam.id = a.modified_by | |
LEFT JOIN w0z9v_categories AS parent | |
ON parent.id = c.parent_id | |
LEFT JOIN w0z9v_content_rating AS v | |
ON a.id = v.content_id | |
LEFT | |
OUTER JOIN (SELECT cat.id AS id | |
FROM w0z9v_categories AS cat JOIN w0z9v_categories AS parent | |
ON cat.lft BETWEEN parent.lft | |
AND parent.rgt | |
WHERE parent.extension = 'com_content' | |
AND parent.published != 1 | |
GROUP BY cat.id ) AS badcats | |
ON badcats.id = c.id | |
WHERE a.access IN (1,1,5) | |
AND c.access IN (1,1,5) | |
AND | |
CASE WHEN badcats.id IS NULL THEN a.state ELSE 0 END = 1 | |
AND a.catid = 8 | |
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2013-07-11 13:29:10') | |
AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2013-07-11 13:29:10') | |
GROUP BY a.id, a.title, a.alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, a.created, a.modified, a.modified_by, uam.name, a.publish_up, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.fulltext, a.state, a.publish_down, badcats.id, c.title, c.path, c.access, c.alias, uam.id, ua.name, ua.email, parent.title, parent.id, parent.path, parent.alias, v.rating_sum, v.rating_count, c.published, c.lft, a.ordering, parent.lft, fp.ordering, c.id, a.images, a.urls | |
ORDER BY c.lft, | |
CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END DESC , a.created | |
LIMIT 0, 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment