0

I have made a three level categorization in my web page. Each articles goes through as SECTION->CATEGORY->SUBCATEGORY. section table has section_id and sectionname fields. category table has category_id, section_id, category name. subcategory table has subcategory_id, category_id, section_id, subcategoryname.

I have made a dynamic drop-down menu with 3 select drop-downs when adding articles to web site (as where do you want to save this article in style). It is working.

Now i want to display this sections, categories, and subcategories in an unordered list but i am lost. What I am seeking for:

<ul>
  <li>Section Name
    <ul>
      <li>Category name for above section
        <ul>
          <li>Subcategory name for above category and section</li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

I shall be happy so much for any help.

Thanks,

1 Answers1

1
SELECT a.subcategory_id, a.subcategory_name,
       b.category
       c.sectionname
FROM subcategory a
INNER JOIN category  b on b.category_id=a.category_id
INNER JOIN sectionName c on c.section_id=a.section_id

if you want it ordered ad:

ORDER BY <some field where you want to order on...>
Luuk
  • 12,245
  • 5
  • 22
  • 33
  • Query works fine. Would you please tell me how to build a multilevel list ? –  Apr 26 '11 at 13:51