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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:14:43+00:00 2026-06-15T11:14:43+00:00

I want to fetch first 10 question haven’t seen by a user. In order

  • 0

I want to fetch first 10 question haven’t seen by a user.
In order to do that, I need to store questions that have seen by that user into a table, named user_questions

So, my query is now:


SELECT * from questions WHERE questions.id NOT IN (select question_id from user_questions where user_id=1) LIMIT 0, 10

From what I have learnt, this query should be slower compare to similar join query. How could I construct a join query that produced the same result?

  • 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-15T11:14:44+00:00Added an answer on June 15, 2026 at 11:14 am

    The equivalent join query is:

    select q.*
    from questions q left outer join
         user_questions uq
         on uq.question_id = q.id and
            uq.user_id = 1
    where uq.user_id is null
    limit 0, 30
    

    One caution, though, the results will not be in random order. Typically with a limit clause, you would also specify an order by.

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

Sidebar

Related Questions

First I want to say that I have looked at stackoverflow and highcharts forum,
I'm new to Stack Overflow and have my first question. I want to develop
I got a Wikipedia article and I want to fetch the first z lines
I want to fetch the user groups and want to list them but I
I want to fetch products by Category id. Because the products have an attribute
I often have the case that I want to work on a SVN repository
First let's explain what I want to do and then ask my question! Well,
Sorry, I want to ask a newbie question :) I have PHP scripts like
i want to make an edit page, when the user go to a question
This is probably a newbie question. I have a table USER which contains info

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.