Thread

This is an archived forum and the content is probably no longer be relevant, but is provided here for posterity.

The active forums are here.

Tweak Categories SQL Query to Only Show Child Categories w/ Entries?

January 03, 2011 9:15pm

Subscribe [1]
  • #1 / Jan 03, 2011 9:15pm

    msmith29063

    74 posts

    I’m using the following tidbit from the WIKI site for displaying child categories of a parent category. Works great.

    {exp:query sql="SELECT cat_url_title as category_url_title, cat_name AS category_name FROM exp_categories WHERE parent_id = '15'"}
    <li><a href="http://{path=channel/category/{category_url_title}}/">{category_name}</a></li>
    {/exp:query}

    How do I tweak the query to only show child categories with entries in them?

    Thanks for your help!

ExpressionEngine News

#eecms, #events, #releases