Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    1

    Unanswered: Query Frustrations

    Hi i got this query

    SELECT COUNT(dbo.Table1.activity) AS TOTAL, dbo.Table2.name
    FROM dbo.Table1 LEFT OUTER JOIN
    dbo.Table2 ON dbo.Table1.activity = dbo.Table2.type
    WHERE (dbo.Table1.activity = 2)
    GROUP BY dbo.Table2.name

    #----------------------------------------------------------------------------------
    and the result is this......

    name TOTAL
    Not Sold 12179
    Hangup 12179
    Doesn't Want to Give ACH 12179
    Doesn't Want to Give CC 12179
    #----------------------------------------------------------------------------------

    what chages should i make in my query to have a result like this.....

    name TOTAL
    Not Sold 13
    Hangup 300
    Doesn't Want to Give ACH 25
    Doesn't Want to Give CC 30

    here's my table definitions
    Table1
    ---------
    activity
    2
    3
    2
    3
    5

    Table2
    --------------------
    type | name
    2 | Not Sold
    3 | Blah
    2 | Hangup
    2 | Doesn't Want to Give ACH
    5 | Do Not Call
    2 | Doesn't Want to Give CC

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Type needs to be unique in Table2.

Posting Permissions

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