Re: [PHP] MySQL NOT IN Query not working

2006-03-16 Thread Miles Thompson

At 08:41 PM 3/16/2006, Kevin Murphy wrote:


Anyone want to point me to why this isn't working:

$hr_query = select dp_lname,dp_fname,dp_id
FROM dir_all
WHERE dp_id NOT IN (SELECT sup_id FROM dir_title2)
ORDER BY dp_lname;

There are two tables, dir_all (the main list of everyone) and
dir_title2 (supplemental). If someone is in dir_title2 then the
sup_id is the same as their dp_id. What I am trying to do is get a
list of every person in dir_all that is NOT in dir_title2. Any
thoughts as to what am doing wrong?

--
Kevin Murphy
Webmaster - Information and Marketing Services
Western Nevada Community College
www.wncc.edu
(775) 445-3326


Kevin,

Looks like an older version of MySQL.
Check your version: subqueries were not supported until ver 4.1.

The older docs at MySQL give a work around.

Miles 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySQL NOT IN Query not working

2006-03-16 Thread Ligaya Turmelle

Kevin Murphy wrote:

Anyone want to point me to why this isn't working:

$hr_query = select dp_lname,dp_fname,dp_id
FROM dir_all
WHERE dp_id NOT IN (SELECT sup_id FROM dir_title2)
ORDER BY dp_lname;

There are two tables, dir_all (the main list of everyone) and  
dir_title2 (supplemental). If someone is in dir_title2 then the  sup_id 
is the same as their dp_id. What I am trying to do is get a  list of 
every person in dir_all that is NOT in dir_title2. Any  thoughts as to 
what am doing wrong?



What does mysql_error() say?

--

life is a game... so have fun.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] MySQL NOT IN Query not working

2006-03-16 Thread Kevin Murphy

Yup. Thats the problem. I'm running 4.0.21. Thanks.

--  
Kevin Murphy

Webmaster - Information and Marketing Services
Western Nevada Community College
www.wncc.edu
(775) 445-3326


On Mar 16, 2006, at 4:48 PM, Miles Thompson wrote:


At 08:41 PM 3/16/2006, Kevin Murphy wrote:


Anyone want to point me to why this isn't working:

$hr_query = select dp_lname,dp_fname,dp_id
FROM dir_all
WHERE dp_id NOT IN (SELECT sup_id FROM  
dir_title2)

ORDER BY dp_lname;

There are two tables, dir_all (the main list of everyone) and
dir_title2 (supplemental). If someone is in dir_title2 then the
sup_id is the same as their dp_id. What I am trying to do is get a
list of every person in dir_all that is NOT in dir_title2. Any
thoughts as to what am doing wrong?

--
Kevin Murphy
Webmaster - Information and Marketing Services
Western Nevada Community College
www.wncc.edu
(775) 445-3326


Kevin,

Looks like an older version of MySQL.
Check your version: subqueries were not supported until ver 4.1.

The older docs at MySQL give a work around.

Miles

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date:  
3/10/2006


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php