Solved

Help with MS SQL views.

Posted on 2007-03-30
3
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
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.

728 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