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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:26:41+00:00 2026-05-12T18:26:41+00:00

I want to select everything from table one, which contains a column JID. These

  • 0

I want to select everything from table one, which contains a column JID. These are available things the player can learn. But there is a table2 which has a list of things the player has already learned. So if JID is in table2, it has been learned, and I do not want that selected from table 1.

For exampel.

table 1
JID Title Description Rank

table 2
JID UserID value1 value2

table 1 might have 100 rows, but if table 2 has 9 rows with some of the JID’s from table 1, I dont want them selected. What is more, it is specific to user ID in table 2. So i need to filter table2 by JID != match JID in table1, but ONLY IF userID = a php variable passed.

Hope this makese sense. I DO NOT want a subquery. I think it is possiblet o use a left outer join on JID, but I am not sure how to invole the USERID… HELP!

ps the JID can be in table1 and table2 if the UID does not match… if it matches, then the JID cannot be found in table2 to be selected.

  • 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-12T18:26:42+00:00Added an answer on May 12, 2026 at 6:26 pm

    with not exists:

    SELECT t1.*
    FROM table1 t1
    WHERE NOT EXISTS (SELECT NULL
                        FROM table2 t2
                       WHERE t2.UID = 'php var'
                         AND t1.JID = t2.JID)
    

    with left join:

    SELECT t1.*
    FROM table1 t1
    LEFT JOIN table2 t2 on t1.JID = t2.JID
                       AND t2.UID = 'php var'
    WHERE t2.JID IS NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Users table and a Payments table. I need a query which
Okay this one has me stumped.. mainly because i have been working on this
I need to get summary data from many many rows. The summary fields are
Suppose I have three tables: user , group and xref , a table that
This is for Entity Framework for .NET 3.5: I have the need to query
HI all, I'm having some difficulty understanding the rationale behind group by aggregation in
Note that I'm a complete SQL noob and in the process of learning. Based
I'm building an offline C# application that will import data off spread sheets and
I have a database where I store keywords grouped into projects and data related
Welcome, I've some problem with Hibernate mapping. Database structure: TableA -ID_A --PK TableB -ID_B

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.