Re: SELECT with WHILE NOT

From: Date: Sun, 26 Jan 2003 01:13:59 +0000
Subject: Re: SELECT with WHILE NOT
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133147@lists.php.net to get a copy of this message
Hi Sean, Before sending to the list, I had already tried your first suggestion and ended up with only the records that I wanted excluded. Your second suggestion with "NOT IN" works like a charm. (There wasn't much about 'NOT' in the docs, and I must have missed the 'IN' part.) Thanks for your help! Regards, Andre On Saturday 25 January 2003 07:48 pm, Sean Malloy wrote: > SELECT * FROM rap WHERE rsponsor != '{$_SESSION['sid']}' ORDER by > rsname,rfname,rcountry,rcity DESC LIMIT 20 > > SELECT * FROM rap WHERE rsponsor NOT IN ('{$_SESSION['sid']}') ORDER by > rsname,rfname,rcountry,rcity DESC LIMIT 20 > > -----Original Message----- > From: Andre Dubuc [mailto:aajdubuc@webhart.net] > Sent: Sunday, 26 January 2003 11:28 AM > To: php-general@lists.php.net > Subject: [PHP] SELECT with WHILE NOT > > > Hi, > > Using PostgreSql 7.2 + PHP I am trying to do a SELECT that will > choose all records except ones that have a certain id number. I can't seem > to > get the syntax to work. > > Here's the code: > > "SELECT * FROM rap WHERE NOT rsponsor = '{$_SESSION['sid']}' ORDER by > rsname,rfname,rcountry,rcity DESC LIMIT 20"; > > What I get is all the records including those with '{$_SESSION['sid']}' . > > How can I accomplish an exclusion in a table-wide search? > > Any help or advice will be greatly appreciated. > > Tia, > Andre

« previous php.general (#133147) next »