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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:01:19+00:00 2026-05-15T06:01:19+00:00

I asked this last week over the weekend and it got buried in the

  • 0

I asked this last week over the weekend and it got buried in the archives before anyone could answer. So forgive me if you’ve already seen this.

I teach classes and want to be able to select those students who have taken one class, but not another class. I have two tables: lessons_slots which is the table for every class such as:

——————–
-ID name slots-
-1 basics 10 –
-2 advanced 10 –
-3 basics 10 –
———————

The other table is class_roll, which holds enrollment info, such as:

——————–
-sID classid firstname lastname-
-1 1 Jo Schmo
-2 1 Person Two
…
-13 2 Jo Schmo
———————

What I want to do, I select everyone who has not had the advanced class (for example). I’ve tried doing

SELECT *
FROM lessons_slots
LEFT JOIN class_roll
ON lessons_slots.ID = class_roll.classid
WHERE lessons_slots.name != ‘advanced’

But that doesn’t work…All it does is eliminate that row, without eliminating the user. I want Jo Schmo, for example, to not show up in the results. Any ideas?

  • 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-05-15T06:01:20+00:00Added an answer on May 15, 2026 at 6:01 am

    Not pretty, but works.

     SELECT c.*
    FROM lessons_slots l
    join class_roll c on l.id=c.classid
    where concat(firstname,lastname) not in (select concat(firstname,lastname)
    from  lessons_slots l
    join class_roll c on l.id=c.classid where name='advanced')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked this question before and got a great working answer. what is the
I asked this over at the jQuery Tools official forum last week, but it's
This is similar to this question I asked last week. My dataGrid is populated
I asked a similar question last week but did not get an answer that
This is related to another question I asked last week, but the current issue
I got asked this question last interview and expect it again. The interview was
I asked this question last week on SO- SQL Exclusion Query It looks like
So based on this question ( here ), of which I asked last week,
I've asked this question before but never actually got it working. More or less,
I asked this last night, and got information on merging (which is unavailable in

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.