首页 > 其他分享 >对count distinct的用法

对count distinct的用法

时间:2023-04-26 10:48:11浏览次数:46  
标签:count distinct 用法 牛客 参数 type id

平均活跃天数和月活人数_牛客题霸_牛客网 (nowcoder.com)

在牛客做这道题时看到了这样的写法。

count(distinct uid,date_format(submit_time,"%Y%m%d")   

 

不禁疑惑count里面可以跟两个参数吗。

其实不是的,还是只有一个参数。

这里面的distinct先起作用.

例如:

select 

distinct id, type

from table

这样的sql语句会去重 组合列(id,type)都相同的记录。

 

所以在count语句中先用了distinct做了一下组合列的筛选,之后在对组合列进行计数,总的来说还是一个参数。     

标签:count,distinct,用法,牛客,参数,type,id
From: https://www.cnblogs.com/myz99/p/17354932.html

相关文章

  • 王者荣耀赵怀真英雄技能中的英语单词-four 四次蓄力攻击,repel 击退敌人,counterattack
    我一般作为上单和打野,比较需要操作和时机的掌握气随心动怀真依次打出掌、拳、肘、靠之劲四种普攻。掌劲起手,造成一次10(+50%物理攻击)物理伤害,对野怪造成1.5倍伤害。满精力时此招位移距离提升。满精力时怀真将突进至敌人身边。拳劲快速击打造成2次20(+50%物理攻击)物理伤害。肘......
  • storm-0.9.3 wordcount例子运行步骤(单机版)
    网上关于Stormwordcount的例子很多,不过都是基于storm-0.9.0.1,在运行例子过程中torm0.9.0.1.jar在maven中央仓库没有找到只有0.9.3,在运行过程中出现了好多问题。所以记下笔记。方便以后查看。1,下载Storm,地址为http://www.apache.org/dyn/closer.cgi/storm/apache-storm-0.9.3/......
  • WordCountTopology 执行日志分析
    1,代码packagestorm.starter;importbacktype.storm.Config;importbacktype.storm.LocalCluster;importbacktype.storm.StormSubmitter;importbacktype.storm.task.ShellBolt;importbacktype.storm.topology.BasicOutputCollector;importbacktype.storm.topology.I......
  • jenkins 用法示例
    示例1:根据参数进行构建  根据参数的值进行不同的操作。#!/bin/bashecho"获取值"echo$Deploycase$Deployin"deploy1")echo123>>/opt/script/aa.log;;"rollback1")echo456>>/opt/script/aa.log;;esac ......
  • CountDownTimer
    CountDownTimer倒计时,可以在主线程使用。//这里所有的参数都是毫秒,使用秒需要time乘以1000//longmillisInFuture倒计时总时间//longcountDownInterval间隔多久倒计时一次//以下参数是一共60秒,每19秒倒计时一次CountDownTim......
  • 2017ACM/ICPC广西邀请赛-重现赛(感谢广西大学)C - Counting Stars 暴力三元环
    LittleAisanastronomylover,andhehasfoundthattheskywassobeautiful!Soheiscountingstarsnow!Therearenstarsinthesky,andlittleAhasconnectedthembymnon-directionaledges.Itisguranteedthatnoedgesconnectonestarwithi......
  • ref用法(获取元素节点)
    importReactfrom'react'exportdefaultclassAppextendsReact.Component{myref=React.createRef()render(){return(<div>{/*获取输入框的内容写法一*/}<inputref=......
  • @Valid 和 @Validated 注解用法详解
     目录案例引入@Valid详解@Validated详解@Valid和@Validated比较  案例引入下面我们以新增一个员工为功能切入点,以常规写法为背景,慢慢烘托出@Valid和@Validated注解用法详解。那么,首先,我们会有一个员工对象Employee,如下:/***员工对象**@authors......
  • CountDownLatch、CycLicBarrier、Semaphore
    减计数器 Asynchronizationaidthatallowsoneormorethreadstowaituntilasetofoperationsbeingperformedinotherthreadscompletes.允许一个或多个线程等待直到在其他线程中执行的一组操作完成的同步辅助程序(一等多场景适用)使用给定的计数初始化CountD......
  • java中排序的正确用法
    publicclassTest{publicstaticvoidmain(String[]args){sort();}publicstaticvoidsort(){List<Integer>list=newArrayList();//降序hitRule.sort((o1,o2)->o2.compareTo(o1));//升序......