Solved

Help with MS SQL views.

Posted on 2007-03-30
3
182 Views
Last Modified: 2010-03-19
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
Comment
Question by:eivo
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Sham Haque
ID: 18822164
select userid
from courses
having count(*) > 10
0
 
LVL 18

Accepted Solution

by:
Sham Haque earned 50 total points
ID: 18822167
sorry:

select userid
from courses
having count(*) >= 10
group by userif
0
 
LVL 4

Author Comment

by:eivo
ID: 18822191
Group by and having should be the other way round (I Think)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question