RE: [PHP-DB] Another SELECTING problem :-(

From: Date: Thu, 09 Aug 2001 20:26:54 +0000
Subject: RE: [PHP-DB] Another SELECTING problem :-(
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11200@lists.php.net to get a copy of this message
At 3:10 PM +0100 8/9/01, Dave Watkinson wrote:
You'll note that both step requires a return, which general means a subquery, I believe for MySQL to hanle subqueries you actually have to perform to separate queries. If your not using MySQL then you could write a statement such as: SELECT empid FROM emp_cont WHERE (SELECT COUNT(empid) FROM emp_cont GROUP BY empid) [note statement may need tweaking since I use MySQL and can't test it] that didn't work
Yeah, that one shouldn't work on MySQL. MySQL doesn't allow subqueries like this. But here's another option you could use: SELECT empid, COUNT(empid) FROM emp_cont GROUP BY empid HAVING COUNT(empid) > 1 I tend to use either group by or having, so forgot that having can be used to limit a group by. But this statement should work for you, as well. Alnisa -- ......................................... Alnisa Allgood Executive Director Nonprofit Tech (ph) 415.337.7412 (fx) 415.337.7927 (url) http://www.nonprofit-techworld.org (url) http://www.nonprofit-tech.org (url) http://www.tech-library.org ......................................... Nonprofit Tech E-Update mailto:nonprofit-tech-subscribe@egroups.com ......................................... applying technology to transform .........................................

« previous php.db (#11200) next »