Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Simple Query

Author  Topic 

Fatalsniper
Starting Member

45 Posts

Posted - 2005-06-10 : 23:06:13
Hi there,

I got this query and I couldn't think of an optimal way to solve it.

What do you think?

I have his table with Relatives of an employee.(Employees->Relatives)

I have to answer how many employees have a group of x persons

Example,

Employees_Amount Family_Group
---------------- ------------
20 1
100 2
153 4
200 6


Instance: I got 100 employees that have 2 family members(Relatives)

I couldn't figure the query.

Thanks in advance...

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-06-12 : 20:29:23
You want to SELECT the COUNT of relatives that are GROUPED BY the employee HAVING said that, I point you towards BOL (Books Online).

HTH

=================================================================
All restraints upon man's natural liberty, not necessary for the simple maintenance of justice, are of the nature of slavery, and differ from each other only in degree. -Lysander Spooner, lawyer (1808-1887)

Go to Top of Page
   

- Advertisement -