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 CCType needs to be unique in Table2.sql
No comments:
Post a Comment