Last post Apr 03, 2012 08:12 AM by HamidCyber
Apr 03, 2012 07:50 AM|HamidCyber|LINK
I have a table with three columns (Id, TagName & ContentId).
I need a query to make the following result.
As you see in this table there is no dublicated TagNames. Instead of it we have TagCount column that counts same TagNames.
I will be happy if you show me a solution to solve it.
Apr 03, 2012 07:59 AM|Ashutosh Pathak|LINK
you can use the code below:
select Id, TagName ,contentID, count(ContentId) as TagCount from yourTable
group by Id,TagName,ContentID
Apr 03, 2012 08:02 AM|Basquiat|LINK
SELECT TagName, MIN(ContentId) as ContentId, COUNT(TagName) as TagCount
GROUP BY TagName
Apr 03, 2012 08:12 AM|HamidCyber|LINK