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:[EMAIL PROTECTED]
   .........................................
    applying technology to transform
   .........................................

Reply via email to