Jump to content

SQL Help needed


genzedu777

Recommended Posts

I went ahead and looked at the document you provided.  Your structure is correct.  subject_level is a classic Many to Many relationship resolver table, resolving the many to many relationship between subject and level.

 

What I would recommend for your queries supporting the forms you're generating, is that you join the tables together using a standard inner join.  You can then order result by level.  As you loop through the result set, you simply set an outer variable on level.  Anytime the level in the result set changes, you would emit a new section with the level heading and a new set of checkboxes. 

 

I would go so far as to say that you should take the same approach in your prior code, where you are instead doing 2 queries.  That is not necessary, as joining the tables together will get you everything you need in one.  If you need the results for only one level, you can always include that in the WHERE clause for the query.

 

If you have any specific questions in regards to your coding, feel free to post them in a followup.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.