Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8974673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:43:40+00:00 2026-06-15T18:43:40+00:00

I have a query that displays the modules that are available for a student

  • 0

I have a query that displays the modules that are available for a student to enrol on and shows them in a list.. I would like it if the modules that student has enrolled on do not show in the list. Once a student has enrolled on a module it is stored in a table called tbl_studentModule which has two fields, regNum ($studentID) and moduleID.

What do I need to add to this query to only show the modules that are not already in the tbl_studentModule with the relevant regNum.

EG I would lik the query to say something to the effect where the combination of regNum and moduleID do not already exist if tbl_studentModule.

Here is what I have so far…

SELECT DISTINCT am.moduleID, m.moduleName, am.type, s.regNum, s.award
FROM tbl_awardModules am
LEFT OUTER JOIN tbl_module m ON am.moduleID = m.moduleID
INNER JOIN tbl_awardLevels al ON am.awardLevelID = al.awardLevelID
INNER JOIN tbl_award a ON al.awardID = a.awardID
INNER JOIN tbl_student s ON a.awardID = s.award
LEFT JOIN tbl_studentModules sm ON s.regNum = sm.regNum
WHERE am.type <> 'C' AND sm.regNum = '$student_id' AND m.moduleName <> 'A_null_Choice' AND m.moduleName NOT LIKE '%Not Running%'

Hope that makes sense…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:43:41+00:00Added an answer on June 15, 2026 at 6:43 pm

    Ok, I sussed it..

    I added

    AND NOT EXISTS (SELECT * FROM tbl_studentModules WHERE regNum = '$student_id' AND moduleID = am.moduleID)
    

    to the end if the query so now it only shows the rows of the table that do not already contain that combination of values

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that gets comments from a database and displays them based
I have a query that displays columns from multiple tables in a test dbase.
I have a problem, i have a query that just simply displays the user
I have a query that basically combines tables of actions and selects from them
I have a query that creates a result set like this: Rank Name 1
I have a query that looks like this SELECT * from myTable WHERE Date
I have a Gridview that displays paged results from a search query. The problem
I have an SQL query that currently displays all the people in table HOTEL
I have a site that displays a list of articles, along with category filters.
I have a loop that displays a list of variables in a dropdown box

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.