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 8288361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:16:09+00:00 2026-06-08T12:16:09+00:00

Ok, so here is an existing query I have that does what I need.

  • 0

Ok, so here is an existing query I have that does what I need.

SELECT C1.id AS id, C1.title AS title, C1.instructor_id AS instructor_id, 
  C1.description AS description, C1.date AS date, C1.starttime AS starttime, 
  C1.endtime AS endtime, C1.training_id AS training_id, C2.name AS name, 
  C2.id AS instructors_id 
FROM trainings C1 
LEFT JOIN instructors C2 ON C1.instructor_id = C2.id

However, I need to add something to it. I have two tables I need to compare in addition to what I have.

Table ‘trainings’ has a list of training sessions, indexed by ‘id’. I also have another table, ‘registrations’, that holds info about what users registered for what training sessions with 3 columns: ‘id’ – index, ‘user_id’ – the ID of the user that registered for a training, and ‘course_id’ – the ID of the training session.

What I need to do in addition to my existing query, is select ONLY the training sessions that do not have a row in ‘registrations’ for that user already.

I hope this makes sense. Thank you for who can help. I have tried for hours. The query is just too large for me to keep organized and to think properly about how to do it.

  • 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-08T12:16:10+00:00Added an answer on June 8, 2026 at 12:16 pm
    SELECT C1.id AS id, C1.title AS title, C1.instructor_id AS instructor_id, 
      C1.description AS description, C1.date AS date, C1.starttime AS starttime, 
      C1.endtime AS endtime, C1.training_id AS training_id, C2.name AS name, 
      C2.id AS instructors_id 
    FROM trainings C1 
    LEFT JOIN instructors C2 ON C1.instructor_id = C2.id
    LEFT JOIN registrations C3 ON < Whatever they're connected on >
    WHERE C3.id IS NULL
    

    Basicly just JOIN that aswell, and filter it through a WHERE ... IS NULL since LEFT JOIN will return joined table’s columns as NULL.

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

Sidebar

Related Questions

I have an existing mysql query that I need to add to and I'm
I have a existing query in the system which is a simple select query
I have an existing SQL query that works fine in SQL Server, that I
I have an existing stored procedure in SQL Server that I need to call
How do I write media query only for 1024px width? Here is my existing
Here is the code I have tried to append a node in existing xml,
I'm converting an existing program to C++ and here need to manipulate Sybase timestamps.
I need to query the database by joining two tables. Here is what I
I have a query that strips data from a XML string, inserts it into
I have a query that should always be returning a single int. I have

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.