Help! Consider the following table:
Sub_ID Aff_ID Entry_date Clicks-------------------------------------33 232 5/1/2006 142 422 5/2/2006 133 83 5/2/2006 376 333 5/3/2006 1... and so on
I have the following statement in SQL Query Analyzer:
SELECT count(*) as counterFROM Ad_Stats_Table WHERE Aff_ID = 33 AND (Entry_Date between '5/1/2006' and '5/16/2006') Group By Sub_ID
That query returns 35,830 rows. But it returns the following:
counter-------1111... (35,830 times!)
I want it to return just 1 row containing the row count like so:
counter-------35830
Can someone help?
Try This:
[code language="T-SQL"]
select count(*)from Ad_Stats_TableWhereSub_ID = 33 And( entry_date between '5/1/2006' and '5/16/2006') Group By Sub_ID
[/code]
or you can also group it by aff_id
select count(*)from Ad_Stats_TableWhereAff_ID = 333And( entry_date between '5/1/2006' and '5/16/2006') Group By Aff_ID
↑ Grab this Headline Animator