DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2007
    Posts
    3

    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

  2. #2
    Join Date
    Feb 2007
    Posts
    3
    Hmm, no one?

  3. #3
    Join Date
    Feb 2007
    Posts
    9
    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.

  4. #4
    Join Date
    Feb 2007
    Posts
    3
    Thanks

    It still seems to want to grab even the records that just have one "instance" in the table.

  5. #5
    Join Date
    Feb 2007
    Posts
    9
    Can you please post your actual query and the output.

Similar Threads

  1. Replies: 13
    Last Post: 08-10-2012, 06:02 AM
  2. problem with counting field
    By dollakay in forum VB Classic
    Replies: 1
    Last Post: 11-24-2006, 03:26 PM
  3. Replies: 5
    Last Post: 11-04-2006, 02:32 PM
  4. Replies: 0
    Last Post: 01-17-2006, 07:23 PM
  5. Factories in VB.NET / Counting references
    By Bill McCarthy in forum .NET
    Replies: 6
    Last Post: 04-17-2002, 05:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links