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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:48:10+00:00 2026-06-12T14:48:10+00:00

I am trying to essentially solve for the following: 1) Find all users in

  • 0

I am trying to essentially solve for the following:

1) Find all users in the system who ONLY have programID 1.

2) Find all users in the system who have programID 1 AND any other active program.

My tables structures (in very simple terms are as follows):

users

userID  | Name
================
1       | John Smith
2       | Lewis Black
3       | Mickey Mantle
4       | Babe Ruth
5       | Tommy Bahama

plans

ID | userID | plan | status
---------------------------
1  |  1     | 1    | 1
2  |  1     | 2    | 1
3  |  1     | 3    | 1
4  |  2     | 1    | 1
5  |  2     | 3    | 1
6  |  3     | 1    | 0
7  |  3     | 2    | 1
8  |  3     | 3    | 1
9  |  3     | 4    | 1
10 |  4     | 2    | 1
11 |  4     | 4    | 1
12 |  5     | 1    | 1

I know I can easily find all members with a specific plan with something like the following:

SELECT * FROM users a JOIN plans b ON (a.userID = b.userID) WHERE b.plan = 1 AND b.status = 1

but this will only tell me which users have an ‘active’ plan 1.

How can I tell who ONLY has plan 1 (in this case only userID 5) and how to tell who has plan 1 AND any other active plan?

Update: This is not to get a count, I will actually need the original member information, including all the plans they have so a COUNT(*) response may not be what I’m trying to achieve.

  • 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-12T14:48:11+00:00Added an answer on June 12, 2026 at 2:48 pm

    Note – I ended up simplifying the overall concept in my head. I simply did a subselect of all members who I knew had the plan I was looking to target. I then did an overall select of all plans by members who either had IDs that were IN or NOT IN the subselect of known ids).

    After testing, this was much less resource intensive and a bit easier to use than the suggestions but appreciate the help.

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

Sidebar

Related Questions

I'm trying to build a Hibernate layer for a database schema I have essentially
Essentially what I'm doing is trying to solve a Rubik's cube with a breadth
I'm essentially trying to do the following on a Java/JSP-driven web site: User supplies
I am essentially trying to accomplish this following: Table 1: MemberID | selection 1
I have the following Scala snippet. In order to solve my given problem, I
I'm trying to solve the problem of having a co-occurence matrix. I have a
I have an application running in Qt that I am essentially trying to re-skin.
I'm trying to figure out how to do this. Essentially I have points A
I am a newbie at matlab and I am trying to solve the following
Here is the problem I'm trying to solve for my game. I have this

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.