Results 1 to 2 of 2

Thread: MSSQL - using count

  1. #1
    Join Date
    Apr 2005
    Posts
    4

    Question MSSQL - using count

    Is it possible to join this query to itself
    and then Sum the count of the [Hit] field to display it
    within the same query?

    Select
    Distinct
    Count (*) as [Total],
    SiteName,
    Grade,
    (Select distinct Count(*)) as [Hit]
    -- Sum(Hit) as [HitTotal]
    From
    Information
    Group by
    SiteName,
    Grade
    Order by
    Sitename,
    Grade

    Total Sitename Grade Hit
    165 West 30 1
    147 West 31 1
    127 West 32 1
    113 East 30 1
    99 East 31 1

    I realize I will see the hit total sum on every record, but that would be ok.

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

Posting Permissions

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