----- Original Message ----- From: "Roger Baklund" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "Obantec Support1" <[EMAIL PROTECTED]> Sent: Tuesday, November 11, 2003 8:46 PM Subject: Re: Query question (php)
> * 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 > Thanks Roger That's just the method i needed! Mark -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]