Main Contents

NOT id IN (1, 2, 3) vs NOT (id IN (1, 2, 3))

September 5, 2008

Problem:

You’re probably wondering why the following query doesn’t  work on some mySQL databases

SELECT * FROM table1 WHERE NOT id IN (1, 2, 3)
works on mySQL v5.0.51a
doesn’t work on mySQL v4.1.21

Solution:

The reason is that the query would confuse the older version what to evaluate by NOT.

This query generally works.

SELECT * FROM table1 WHERE NOT (id IN (1, 2, 3))
works on mySQL v5.0.51a
works on mySQL v4.1.21

This is basically just specifying what should value should be evaluated by NOT.

Filed under: MySQL | Comments (2)
Related Links:

2 Comments

  1. GILBERT June 26, 2010 @ 4:25 am

    Pillspot.org. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Pillspot.org. Vitamins@buy.online” rel=”nofollow”>.…

    Categories: Antiviral.Antibiotics.Eye Care.Anxiety/Sleep Aid.Skin Care.Stop SmokingWeight Loss.Mental HealthMens Health.Blood Pressure/Heart.Vitamins/Herbal Supplements.Anti-allergic/Asthma.Womens Health.Pain Relief.Antidiabetic.Antidepressants.St…

  2. ORLANDO July 21, 2010 @ 9:26 am


    MedicamentSpot.com. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.Best quality drugs. Online Pharmacy. Order pills online

    Buy:100% Pure Okinawan Coral Calcium.Actos.Accutane.Mega Hoodia.Prevacid.Arimidex.Petcam (Metacam) Oral Suspension.Retin-A.Synthroid.Zyban.Prednisolone.Lumigan.Nexium.Zovirax.Valtrex.Human Growth Hormone….

Leave a comment