mysql timestamp

 select from_unixtime(m.createdAt, '%Y-%m-%d %H:%i:%s') from kfrobotaidlog m;

select m.customeruid, from_unixtime(m.createtime, '%Y-%m-%d %H:%i:%s') as `date-time`, m.kfuid,
case when m.kfuid = 1001 then '自动回答' when type = 2  then '人工回答'  else '客户问题' end as `问答`, 
m.content as `内容` from kfmessage m
join (select distinct customeruid from kfmessage where kfuid = 1001 
and 

createtime >=  
UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 00:00:00', '%Y-%m-%d %H:%i:%s')) AND 
UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 07:00:00', '%Y-%m-%d %H:%i:%s'))) 

m2 on m.customeruid = m2.customeruid
where 
m.createtime > UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 00:00:00', '%Y-%m-%d %H:%i:%s')) 
and 
m.createtime < UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 10:00:00', '%Y-%m-%d %H:%i:%s')) 
and
m.kfuid <> 1002
order by m.customeruid, id 

=======================波哥查询=========================

查看customeruid

select m.customeruid, m.content, a.clientQuestion, a.answer from kfrobotaidlog a join kfmessage m on a.messageId = m.id group by m.customeruid

=================

分析智能客服对话

 select from_unixtime(m.createdAt, '%Y-%m-%d %H:%i:%s') from kfrobotaidlog m;

select m.customeruid, from_unixtime(m.createtime, '%Y-%m-%d %H:%i:%s') as `date-time`, m.kfuid,
case when m.kfuid = 1001 then '自动回答' when type = 2  then '人工回答'  else '客户问题' end as `问答`, 
m.content as `内容` from kfmessage m
join (select distinct customeruid from kfmessage where kfuid = 1001 
and 

createtime >=  
UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 00:00:00', '%Y-%m-%d %H:%i:%s')) AND 
UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 07:00:00', '%Y-%m-%d %H:%i:%s'))) 

m2 on m.customeruid = m2.customeruid
where 
m.createtime > UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 00:00:00', '%Y-%m-%d %H:%i:%s')) 
and 
m.createtime < UNIX_TIMESTAMP(STR_TO_DATE('2019-01-20 10:00:00', '%Y-%m-%d %H:%i:%s')) 
and
m.kfuid <> 1002
order by m.customeruid, id 

 ====================

查找某一天接入的人的数量

select * from
(select m.customeruid, m.content, a.clientQuestion, a.answer,a.questionUid,from_unixtime(a.createdAt, '%Y-%m-%d %H:%i:%s') as createtime from kfrobotaidlog a join kfmessage m on a.messageId = m.id ) t
where createtime> '2019-01-31 00:17:09' and createtime< '2019-02-01 00:17:09'

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

AndroidStudio封装SDK的那些事

<divclass"markdown\_views"<!flowchart箭头图标勿删<svgxmlns"http://www.w3.org/2000/svg"style"display:none;"<pathstrokelinecap"round"d"M5,00,2.55,5z"id"raphael

mysql简单常用语句汇总

1\.常用函数uuid和时间戳SELECTUUID(),UNIX_TIMESTAMP();将时间戳转为日期格式FROM_UNIXTIME(mw.created_at,'%Y%m%d%H:%i:%s')设置参数select@m_no:max(m_no)fromvc_m;set@m

Python之time模块的时间戳、时间字符串格式化与转换

Python处理时间和时间戳的内置模块就有time,和datetime两个,本文先说time模块。关于时间戳的几个概念时间戳,根据1970年1月1日00:00:00开始按秒计算的偏移量。时间元组(struct_time),包含9个元素。 time.struct_time(tm_y

mysql设置时区

mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0