Sure. I am trying to output the contents of a CSS drop-down menu. For the menu, I need to demarcate the first item in a given submenu group as "<ul>" and the last item as "</ul>". Like so:
<ul id="menu">
<li><a href="#">Home</a></li>
<li><a href="#">Horses</a>
<ul>
<li><a href="#">Ceramic</a></li>
<li><a href="#">Custom</a></li>
<li><a href="#">Plastic</a>
<ul>
<li><a href="#">Arabian</a></li>
<li><a href="#">Stock Horse</a></li>
<li><a href="#">Other</a></li>
</ul>
<li><a href="#">Resin</a></li>
</ul>
</ul>
The table data looks like the attached screenshot. Field2 tells me if it's a top level or submenu item, because top level items do not need "<ul>" tags. Field1 tells the system by number what particular submenu a given item belongs to (4 is one group, 5 is another, and there will be more). I have each item ordered by the Display Order field because the items shouldn't appear in alphabetical order.
Another member here showed me, using mysql_dataseek, how to locate the last row in each submenu group so I could plug in the closing "</ul>" tag. What I am trying to do now is to locate the first "4" or first "5" in each group so I can have it stick in the opening "<ul>" tag. If I had any idea how difficult this was going to be, I probably would have opted to just put the darn tags in the table manually.
Query2 identifies all the submenu rows first matching 4 or 5 in Field1, and then returns their 'Key" field values. By comparing it to Query1 which is the full contents of the CSS Menu table, I thought what I was going to get is something checking whether any given row was the "first" 4 or 5, dropping in the tag where needed, and then moving to the next row. Not so much.