sql query to get highest results
I have asked a similar question before but since I did not get a response I was hoping to simply it a little better.
I have a table of records that containing google type results for example for a certain term there are specific number of records. I want a query that will select the terms for a given day with number of results per term in decreasing order.
Example Table
term dateadded resulturl
marines开发者_开发百科 2011-05-19 http:.../
SELECT term, COUNT(*) AS TermCount
FROM YourTable
WHERE dateadded = @YourDate
GROUP BY term
ORDER BY TermCount DESC
Select term
, Count(*) as Result_Count
from TableName
where dateadded = @GivenDay -- don't know if time is a factor
group by term
order by result_count desc
精彩评论