* Obantec Support1 
> mysql 3.23.56 RH 8.0
> 
> I have got the sql query to work but is there a better way of writing the
> syntax?
> 
> $sql = "SELECT * FROM Contacts WHERE Categories=\"$calltype\" and
> BusinessCodes !=\"R\" and BusinessCodes !=\"I\" and BusinessCodes !=\"L\"
> ORDER BY Company ASC";
> 
> basically i Categories (a limit number of 4 or 5 types) but exclude 'n'
> number of BusinessCodes defined by 1 or 2 ASCII letters.
> 
> I tried BusinessCodes !=\"R\". !=\"I\". !=\"L\" but get Couldn't execute
> query

You could use the IN operator and single quotes to make it easier to read:

$sql = "SELECT * FROM Contacts WHERE Categories='$calltype' and
  BusinessCodes NOT IN ('R','I','L') ORDER BY Company ASC";

-- 
Roger

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to