SQL query -Help

Results 1 to 2 of 2

Thread: SQL query -Help

  1. #1
    Join Date
    Dec 1969

    Default SQL query -Help

    Hi,<BR> I have the following query<BR>select emp_id,count(*) <BR>from empDept<BR>group by emp_group_id<BR><BR>I want to pull only records whose group count (count(*) is greater than 2. How do I include that in the query??

  2. #2
    Join Date
    Dec 1969

    Default Didn't you ask this already?

    Ehhh...probably somebody else.<BR><BR>SELECT emp_group_id, Count(*)<BR>FROM empDept<BR>GROUP BY emp_group_id<BR>HAVING Count(*) &#062; 2<BR><BR>Your SQL was wrong, using emp_id and emp_group_id. Since I assume that emp_id is a PK, I figured the emp_group_id was the right field to use.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts