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
 Other SQL Server Topics (2005)
 Records Count

Author  Topic 

sana17
Starting Member

2 Posts

Posted - 2011-02-12 : 12:23:39
I have an example.. let say two tables 'Student' and 'Courses', they contains PK 'StudId' and 'CourseId' respectively.
Now there is one more table.. 'CoursesEnrolled' which has two columns StudId and CourseId which refer to above mentioned PKs.
Can anyone tell me the query for getting StudId of those students who are enrolled in more than X(any number) courses from table 'CoursesEnrolled'.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-12 : 22:15:53
hint : use GROUP BY with HAVING


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

Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-13 : 04:31:37
Can you show what you have done so far!! :D
Go to Top of Page

sana17
Starting Member

2 Posts

Posted - 2011-02-13 : 04:47:47
Well thanks.. i missed the 'Having' clause
Now its done !!
Go to Top of Page
   

- Advertisement -