Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Help with MS SQL views.

Hi
I have a table in Microsoft SQL Server 2000 that contains information on a set of courses done by a group of individuals. basically when an individual completes a course, their userID and the courseID is added to this table, essensially creating a list of every completed course.

what I would like to do, is create a view where I could see a list of all userIDs that have completed say 10 courses in total (therefore have 10 records on the completed course table to their name)

can anyone help? i'm having a mental block on SQL today..

Many thanks.
0
eivo
Asked:
eivo
  • 2
1 Solution
 
Sham HaqueSenior SAP CRM ConsultantCommented:
select userid
from courses
having count(*) > 10
0
 
Sham HaqueSenior SAP CRM ConsultantCommented:
sorry:

select userid
from courses
having count(*) >= 10
group by userif
0
 
eivoAuthor Commented:
Group by and having should be the other way round (I Think)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now