Reputation: 460
I have a database column topics
with datatype nvarchar
. I have to search in these records to find the "TRENDING TOPICS" and display them.
By "TRENDING TOPICS", I mean to say that I want to get the most discussed topic. For example, from the feed titles in twitter, I need to select the most discussed topic and the count of it.
How to approach this? Pls help..
Edit:
I have 4 records in the table as:
1 - Aenean at enim lorem ipsum dolor sit amet
2 - Morbi nulla diam, fermentum ullamcorper commodo blandit
3 - Quisque a sapien mi, ac congue orci
4 - Lorem ipsum dolor sit amet, consectetur adipiscing elit.
I have to find the most discussed topic from these rows. For example: Lorem ipsum dolor sit amet
comes in records 1 & 4. So, this is the most discussed topic. Likewise from thousands of rows, I need to find 5 mostly discussed topic. The topic could be a single word too.
Note: I am not giving any input to the query.
Is there any way I could attain the purpose (even with Analysis Services(SSAS))?
Upvotes: 0
Views: 326
Reputation: 754983
You're not very clear with your question - can you possibly provide some examples of what may be stored in your topics
column??
I'm guessing this query alone won't solve your problem:
SELECT topics, COUNT(*)
FROM dbo.YourTable
GROUP BY topics
ORDER BY COUNT(*) DESC
Upvotes: 1