Wednesday, March 7, 2012

How to get most used data from table

I have a table where there are two columns like beginsite and endsite.Now,i
want to see which are the most entered 100 endsites for a particular
beginsite.Any
pointers on the query ?
regards,
ani
I am not sure if I understand your request but try this:
SELECT TOP 100 EndSite, COUNT(*) AS Totals
FROM YourTable
WHERE BEginSite = xxx
GROUP BY EndSite
ORDER BY COUNT(*) DESC
Andrew J. Kelly SQL MVP
"c_ani" <cani@.discussions.microsoft.com> wrote in message
news:88D1830B-18EB-4AEF-B4E5-9AEF499A3CE6@.microsoft.com...
>I have a table where there are two columns like beginsite and endsite.Now,i
> want to see which are the most entered 100 endsites for a particular
> beginsite.Any
> pointers on the query ?
> regards,
> ani

No comments:

Post a Comment