RX
求(在某个time里,js_id出现最多的)
比如times=1026,js_id=11(表名是topclick)js_id   times
  11    1026
  12    1026
  11    1026
  11    1026
  13    1025

解决方案 »

  1.   

    select js_id,count(*) as total 
    from topclick 
    where times='1026' 
    group by js_id 
    order by total desc limit 1;
      

  2.   

    select times,js_id,count(js_id) as num from topclick group by times,js_id
    从这里边找出你想要的随便哪个js_id 最多的就行
      

  3.   

    因为查询出来有很多相同的"js_id,times"记录,每个js_id都对应多个相同的times。
    下面写法有更好地可读性:
    select js_id,count(times) as total 
    from topclick 
    where times='1026' 
    group by js_id 
    order by total desc limit 1;