|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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... |
|
#3
|
|||
|
|||
|
In mysql, the proper "not equal to" statement is <> not !=
|
|
#4
|
|||
|
|||
|
Actually, either != or <> are perfectly acceptable.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > select using != |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|