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

  • SEARCH
  • Home
  • 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 8309041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:59:23+00:00 2026-06-08T18:59:23+00:00

I might have a problem with my SQL query. In this query I’m combining

  • 0

I might have a problem with my SQL query. In this query I’m combining 4 different tables.

  • I have a table courses where general information is stored (course_number, course_title).
  • I have a table employees where general information of employees isstored (empname, and a job_id).
  • A employee has a job. A employee needs to take courses. It depends on the job which courses he has to take. This info is stored in the table job_course (with the job_id and the course_id).
  • If a employee completed a course it is stored in the table emp_courses (with the e_id and the course_id)

Now I want to search a certain course – when the user presses the search button he should get two different results.

  • The first one: here you can see which employee already took this course (this query works so far)
  • the second one: here you can see which employee still needs to take the course. So i need to check which job the employee has and if he needs to make that course . and also i just want to have the ones that are not completed yet.
    And that’s the query that is not working

Here it is:

OpenDb_Open("select course_number,course_title, empname from course 
INNER JOIN (job_course INNER JOIN (employee INNER JOIN emp_course  
ON emp_course.e_id<>employee.e_id) ON job_course.job_id=employee.job_id) 
ON course.course_id=job_course.course_id 
where course_number like '" + coursenumber + "'");

Can someone please help me with this?

  • 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-08T18:59:25+00:00Added an answer on June 8, 2026 at 6:59 pm

    Courses the employee hasn’t taken.

    SELECT * FROM courses
    WHERE course_number IN (
        SELECT course_id FROM job_course
        WHERE course_id NOT IN (
            SELECT course_id FROM emp_courses
            WHERE emp_id = {someid}
        ) AND job_id = (
            SELECT job_id FROM employees
            WHERE emp_id = {user_input}
        )
    )
    

    Which employees still need to take a course.

    SELECT emp_name FROM employees
    WHERE emp_id NOT IN (
        SELECT emp_id FROM emp_courses
        WHERE course_id = {user_input}
    )
    

    Variant of above.

    SELECT emp_name FROM employees
    WHERE emp_id NOT IN (
        SELECT emp_id FROM emp_courses
        WHERE course_id = (
            SELECT course_id FROM courses
            WHERE course_number = {user_input}
        )
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very confused and am hoping someone might have had this problem and be
I'm curious how others have solved this problem, and what problems might lurk behind
In one of my process I have this SQL query that take 10-20% of
I have discovered that in SQL Reporting there might be a problem. I have
I have a small problem with an SQL query. Maybe I just couldn't wake
I have a (big) problem that all of you that work with Webforms might
Woo, I have a doozy of a problem (might even be one for the
This might have to be broken down a bit but what i want to
I have a query with about 6-7 joined tables and a FREETEXT() predicate on
I have an SQL query in PostgreSQL that I'd like to translate to Django.

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.