如何计算谁在MySQL中的命中率最高

And*_*eas 0 php mysql count

我有一个表列名为投标,我想列出多少条记录有每个存在的出价价值.

有点制作TOP TEN列表.

例:

以1为单位的出价有5个条目/行. 以2为单位的出价有3个条目/行. 以3为单位的出价有8个条目/行.等等

如何进行查询以计算和总结每个出价并按DESCending顺序排序?

感谢任何帮助!

jue*_*n d 6

这应该适用于MySQL

select u.firstname, t.bid, count(*) as counts
from your_table t
join users u on u.bid = t.bid
where t.confirmed <> '0000-00-00 00:00:00'
group by t.bid
order by counts desc
Run Code Online (Sandbox Code Playgroud)

一般来说你可以做到

select u.firstname, t.bid, t.counts
from 
(
  select bid, count(*) as counts
  from your_table 
  where confirmed <> '0000-00-00 00:00:00'
  group by bid
) t
join users u on u.bid = t.bid
order by t.counts desc
Run Code Online (Sandbox Code Playgroud)