Results 1 to 2 of 2

Thread: SQL Query

  1. #1
    Join Date
    Jan 2010
    Posts
    72

    Unanswered: SQL Query

    Please help me to write the below SQL query.

    There is a table with group_ids (‘gid’) and emp_ids (‘eid’). Each gid only resides on a single eid and each eid may contain multiple gids. How do you find how many gids are on each and every eid? Please provide the SQL.


    Thanks in advance.
    Last edited by regtha; 05-27-10 at 16:31.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by regtha View Post
    How do you find how many gids are on each and every eid?
    Code:
    SELECT eid
         , COUNT(*) AS gcount
      FROM daTable
    GROUP BY eid
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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