sql查询以获得最高结果

发布于 2024-11-09 03:28:11 字数 223 浏览 0 评论 0原文

我以前问过类似的问题,但由于我没有得到答复,我希望能简单一点。

我有一个包含谷歌类型结果的记录表,例如对于某个术语,有特定数量的记录。我想要一个查询,该查询将选择给定日期的术语,每个术语的结果数量按降序排列。

示例表

term      dateadded    resulturl
marines   2011-05-19   http:.../

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:.../

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撕心裂肺的伤痛 2024-11-16 03:28:11
SELECT term, COUNT(*) AS TermCount
    FROM YourTable
    WHERE dateadded = @YourDate
    GROUP BY term
    ORDER BY TermCount DESC
SELECT term, COUNT(*) AS TermCount
    FROM YourTable
    WHERE dateadded = @YourDate
    GROUP BY term
    ORDER BY TermCount DESC
微暖i 2024-11-16 03:28:11
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
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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文