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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:59:35+00:00 2026-06-02T18:59:35+00:00

I have a query with NOT IN . I’ve heard MySQL doesn’t support NOT

  • 0

I have a query with NOT IN. I’ve heard MySQL doesn’t support NOT IN, but I can’t figure how to rewrite it.

My query is:

SELECT * FROM quests
  WHERE id NOT IN ('" .$quest_completed. "') 
  AND location=" .$location_id. "
  AND (follows=0 OR follows IN ('" .$quest_completed. "')) 
  ORDER BY title

eg:

SELECT * FROM quests 
WHERE id NOT IN (6,21) AND 
  location=8 AND 
  (follows=0 OR follows IN (6,21))
ORDER BY title

Row id 6 is being returned in that when I specified WHERE id NOT IN 6

  • 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-02T18:59:37+00:00Added an answer on June 2, 2026 at 6:59 pm

    It looks like, because of your use of apostrophes around the $quest_completed variable, the query that’s actually being executed is likely to be NOT IN ('6,21'), rather than NOT IN (6,21) (which I think is what you want?).

    The difference is that the first version returns records where id is not equal to the string '6,21', whereas the second version returns records where id is neither the number 6 nor the number 21.

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

Sidebar

Related Questions

I have a query like this SELECT user_id FROM user WHERE user_id NOT IN
I have a query, but I can't figure out how to modify it to
I have this query working but it is not returning back exactly what I
I have a query returning the counts of some data, but I do NOT
Say I have a linq query select r in db.Roles where r.RoleName DOES NOT
I have a SQL query that I'm trying to write, but I'm not quite
I have the following query: var req= (from tl in resultlist where (tl.Message.StartsWith(Do not
I have the following SQL query I was given, but I am not sure
I have this query to be run: string query = @SELECT * FROM hint
A have a code like this: $em = $this->getDoctrine()->getEntityManager(); $query = $em->createQuery(SELECT p FROM

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.