-
Counting occurrences
Hello all, I have a question for you. I have a DB in SQL 2000 that I am accessing with SQL 2005 Reporting Services.
I have the report set up to display the records in the order that I want them, but I would like to add one more parameter. I would like to code in a way to return the results based on the number of times a person's username is in the DB.
The query results are already displayed within a date range, and I want to further filter them by only listing the ones that have >3 occurrences (username) within that date range.
Any help is greatly appreciated.
Thanks
-
-
You can try this..
Select Username, X, X, Y from tblYYY Where Username in (
Select UserName From tblYYY Group by UserName Having Count(UserName) > 3) AND Date (Between date1 and date2);
Last edited by unhitchedjet; 02-25-2007 at 11:01 PM.
-
Thanks
It still seems to want to grab even the records that just have one "instance" in the table.
-
Can you please post your actual query and the output.
Similar Threads
-
Replies: 13
Last Post: 08-10-2012, 06:02 AM
-
By dollakay in forum VB Classic
Replies: 1
Last Post: 11-24-2006, 03:26 PM
-
Replies: 5
Last Post: 11-04-2006, 02:32 PM
-
Replies: 0
Last Post: 01-17-2006, 07:23 PM
-
By Bill McCarthy in forum .NET
Replies: 6
Last Post: 04-17-2002, 05:49 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks