开发者

sql query to get highest results

开发者 https://www.devze.com 2023-03-07 13:15 出处:网络
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 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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号