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 2005 Forums
 Transact-SQL (2005)
 difficult select

Author  Topic 

mixalis
Starting Member

8 Posts

Posted - 2008-09-05 : 05:31:06
I am using 4 tables :
tasks headers (user_fk)
users (user_pk)
pivot_teams_users (team_fk,user_fk)
teams (team_pk)

note that many teams can have many users thus the pivot table

my question is how can I select count of the tasks that are assigned to a certain team...

thanx in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-05 : 05:47:56
[code]
select tu.team_fk, count(*)
from pivot_teams_users tu
inner join tasks t on tu.user_fk = t.user_fk
group by tu.team_fk[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -