If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > howto get at max 2 employee fron each table?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-29-10, 04:14
richa.19.jain richa.19.jain is offline
Registered User
 
Join Date: Mar 2010
Posts: 4
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
Reply With Quote
  #2 (permalink)  
Old 03-29-10, 06:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
what a coincidence, somebody else posted an almost identical question in a different forum...

How to get at max 2 employee from each department?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 04-01-10, 04:02
mishaalsy mishaalsy is offline
Registered User
 
Join Date: Aug 2009
Posts: 262
and the silly thing is , this is not even ms-access forum .
Reply With Quote
Reply

Tags
ms access, sql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On