Results 1 to 3 of 3

Thread: SQL Help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2003
    Posts
    96

    SQL Help

    What I'm trying to get is a report in that shows how many times a DCN Number appears in the report.

    I get that but I can't order the Report by the count.
    I want the Greatest number of duplicates at the top of my report.

    Code:
    SELECT DISTINCT DCN, COUNT(*) AS TheCount
    FROM         dbo.ProviderOONUsage
    WHERE     (PrvNum LIKE '%829%')
    GROUP BY TheCount
    Can someone help me?

    Thanks,

    -Ober
    There Are No Stupid Questions, But There Are A Lot Of Inquisitive Idiots

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Code:
    SELECT DCN, COUNT(*) AS TheCount
    FROM         dbo.ProviderOONUsage
    WHERE     (PrvNum LIKE '%829%')
    GROUP BY DCN
    ORDER BY TheCount
    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    Use ORDER BY TheCount DESC to get the largest numbers first...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width