I need to get the count of News , it gives me error
Column 'News.NewsId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
select News.NewsId
, News.NewsTitle
, COUNT(News.NewsId) as Total
from News inner join NewsCategory on News.NewsId = NewsCategory.NewsId
where NewsCategory.CategoryId in (Select CategoryId
from Category
where CategoryName = 'travel'
or CategoryName = 'Technology'
or CategoryName = 'Sport')
newsid? Meaning do you want multiple records returned? If so, you are simply missing thegroup byclause. Add this to the end:group by news.newsid, news.newstitle... If not, you should better define your question...