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 table Animal. I want to return everything from this table + one
i have users table and i have posts table i want select from users
Sometimes if I want to quickly copy records from one table to another (that
My table has a 'number' column which ranges from 0 to around 1000. I
how can I use Zend_Db_Select to directly select from a subquery (derived table)? See,
I want to SELECT a formatted date string from a datetime type in SQL
i want to echo out everything from a particular query. If echo $res I
I have a table that has a column that contains links. Each cell in
I have a large table to display and enter data. Each cell contains one
I am trying to copy one table over another one atomically. Basically I want

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.