Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old February 16th, 2004, 04:19 PM
stevejones stevejones is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Orlando, Half Asleep
Posts: 102 stevejones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
MYSQL NOT OPERATOR

I am trying to get the 'NOT' operator to work. I purchased the MYSQL bible and it had a short blurb in there about NOT but that was it.

What I am trying to accomplish is this.
I want to do a look up for a range where anything not in that range apears.

A NON working Example, IN A PERFECT WORLD WOULD LOOK LIKE THIS:
$sql = "SELECT * FROM table WHERE range !> '1' AND range !< '10'";

THE ACTULAY CODE I AM TRYING THAT IS NOT WORKING IS:
$sql = "SELECT * FROM table WHERE range NOT (range > '1' AND range < '10')";

I am using MySQL 3.23.56

1. does the NOT operator even work and if so does anyone know for what version?
2. Is there a way to accomplish this with my current version of mysql.

Thanks,

Steve

Reply With Quote
  #2  
Old February 16th, 2004, 05:42 PM
honcho's Avatar
honcho honcho is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Cape Cod
Posts: 1,347 honcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 2 sec
Reputation Power: 3
RE: MYSQL NOT OPERATOR

Try using NOT BETWEEN:

SELECT * FROM table WHERE range NOT BETWEEN 1 AND 10

Reply With Quote
  #3  
Old February 16th, 2004, 05:45 PM
brewthatistrue brewthatistrue is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: CA, USA
Posts: 277 brewthatistrue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 sec
Reputation Power: 2
RE: MYSQL NOT OPERATOR

what kind of error do you get?
try
Code:
WHERE NOT (range > '1' AND range < '10')
or
Code:
WHERE (range < '1' OR range > '10')
or
Code:
WHERE NOT (range BETWEEN 1 AND 10)
these are untested ideas. use the ideas, not just the syntax :p

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > MYSQL NOT OPERATOR


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway