★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum4/HTML/000683.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  MySQL
  select using !=

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   select using !=
tonym
Junior Member
posted July 09, 2000 04:48 AM     Click Here to See the Profile for tonym   Click Here to Email tonym     Edit/Delete Message Reply w/Quote
I'm using this sql statement to retrieve records from my table where the field view does not equal 1 (view is an INT field size 4)

$sql = mysql_query("select * from mytable where view !=1 order by date_written desc");

But it doesn't work - it returns no records.

I changed it to this and this works:

$sql = mysql_query("select * from mytable where view ='' OR ISNULL(view) order by date_written desc");

But I thought the first one would work - can anyone put me right as to why the first select query doesn't work?

TIA, Tony

SepodatiCreations
Member
posted July 09, 2000 11:20 PM     Click Here to See the Profile for SepodatiCreations   Click Here to Email SepodatiCreations     Edit/Delete Message Reply w/Quote
I tried your first statement and it worked fine for me. i'm not sure what the problem could be. what version are you using??

---John Holmes...

drewbacca
Junior Member
posted July 10, 2000 07:12 PM     Click Here to See the Profile for drewbacca     Edit/Delete Message Reply w/Quote
In mysql, the proper "not equal to" statement is <> not !=

rod k
Member
posted July 10, 2000 08:26 PM     Click Here to See the Profile for rod k   Click Here to Email rod k     Edit/Delete Message Reply w/Quote
Actually, either != or <> are perfectly acceptable.

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.