需要一个选择查询?计算出现独特时间的id的数量?

时间:2017-03-28 10:20:46

标签: mysql

需要一个select查询,它应该从表中计算cat_id [输出应为4] [1]

[1]:https://i.stack.imgur.com/CaQmC.png output 4

2 个答案:

答案 0 :(得分:0)

select COUNT (DISTINCT cat_id)
from table_name

答案 1 :(得分:0)

function FullscreenClick(e){
ADTECH.expand();
ADTECH.registerVideoPlayer(videoBGPlayer , 'VideoExpanded');
videoBGPlayer.removeEventListener('timeupdate',timeCheck,false);
TweenLite.to(wrapper , 1 , { height: 546 });
TweenLite.to( videoBGPlayer , 1 , {bottom:"+=150",  ease: Elastic.easeOut.config(1, 0.3)});
TweenLite.to( audioOn , 0.4 , { opacity: 1  }  );

fullscreenButton.style.visibility = 'hidden';
fomButton.style.visibility = 'visible';
videoBGPlayer.load();
videoBGPlayer.play();
videoBGPlayer.muted = false;
closeButton.style.visibility = 'visible';
window.parent.postMessage('ExpandCreative', '*');
expanded = true;
}

你可以在这里检查类似的逻辑: https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_having 使用此查询:

SELECT count(CustomerID),Country 来自客户的国家/地区 有计数(国家)= 1