Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2010
    Posts
    4

    Unanswered: howto get at max 2 employee fron each table?

    Hello Sir,
    I need a SQL query in whichi want to select N number of employee from table Training_emp such that
    ----> There are at max 2 emp from any department

    MyTableStructure is:
    Training_emp:
    Emp_code
    Topic
    Session
    Month
    Inn_add
    Attend
    Date

    Emp_master:
    Emp_code
    DeptName

    now what i want is..to select say 20 employees from Training_emp table....
    suct that no more that two employeees from same departnment are selected.
    My frontend is VB and back end is MS access

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what a coincidence, somebody else posted an almost identical question in a different forum...

    http://www.dbforums.com/microsoft-ac...epartment.html
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Aug 2009
    Posts
    262
    and the silly thing is , this is not even ms-access forum .

Tags for this Thread

Posting Permissions

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