I have a query which returns 20 rows.
select year( ArticleDate )
from NewsData nd
inner join NewsCategories nc on nd.DirectNewsID = nc.DirectNewsID
where nd.Deleted = 0
and year( nd.ArticleDate ) = 2006
group by nd.DirectNewsID;
Is it possible to get this to return a single row with the number 20 followed by the year in the and section?
The end query will not contain and year( nd.ArticleDate ) = 2006, so it will return a single row per year with the count. I only added the and year( nd.ArticleDate ) = 2006 for testing purposes.
Is this possible?
Something like this?
EDIT
This now counts the distinct occurances of
nd.DirectNewsIDin each year.