close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

recordset self join

Thread began 5/22/2016 7:47 pm by Christopher West | Last modified 5/24/2016 12:43 pm by Christopher West | 295 views | 5 replies

Christopher WestCommunity Expert

recordset self join

Hey there I wondered if you could give me some pointers on defining a mysqli self join recordset?

I believe this may help me solve my long issue on coding a website navigation.

I have 3 tables.

1. products (I may store a CategoryParentID here as well if it helps coding logic)
2. categories (This stores both parent categories AND child categories in the field CategoryParentID and CategoryID (auto increment)
3. catalog (this stores ProductID and CategoryID (and possibly CategoryParentID if needed)

NOTE: for the categories table I am also storing CategoryTopMenu (either 1 or NULL) this allows the category to be placed as a top level category. I didnt use CategoryParentID for this because it limits me in what I want to do) - I want the client to be able to create (show/hide) top level categories in the menu bar) Some of these top level categories will have child categories but others may just navigate to the category listing page.

If there is a parent category that includes child categories then I want the customer to click on the initial link that will display ALL products for the parent category, or the customer can hover over a child category.

I think I maybe close to a solution if I create a self join on the above tables in some way so that I can loop the parent records and then in the menu code, i can loop any child records.

here is the structure of the menu code in basic form:

....begin loop
<li><a href="../category.php?Department=&Category=">ParentCategory</a>

<ul class="dropdown">
...begin loop
<li <a href="../category.php?Department=&Category=">ChildCategory</a> </li>
...end loop

</li>...end loop

So for the above menu structure (knowing that the one table contains parent and child records it would make sense to use a self join sql query right?


Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...