Asp.net 如何用sql编写此查询?关于时间差
此格式的数据类型为“DateTime” Mysql查询Asp.net 如何用sql编写此查询?关于时间差,asp.net,sql,Asp.net,Sql,此格式的数据类型为“DateTime” Mysql查询 starttime endtime 2013-01-23 06:49:00 2013-01-23 06:50:00 输出 select timediff(max(endtime),min(starttime)) as t1,totalduration from dmaconf1 where refconfuuid ='007f40bd-ed70-4e7f-aa47-ba1ab12e5734'
starttime endtime
2013-01-23 06:49:00 2013-01-23 06:50:00
输出
select timediff(max(endtime),min(starttime)) as t1,totalduration from dmaconf1 where refconfuuid ='007f40bd-ed70-4e7f-aa47-ba1ab12e5734' and userid ='Piyush_Jain'
MsSql
错误
Msg 195,级别15,状态10,第1行'timediff'未被识别
内置函数名
在MS SQL中,应该使用datediff函数
您好,先生,我收到错误消息208,级别16,状态1,第1行对象名称“dmaconf1”无效。您有名称为“dmaconf1”的表吗在您的DB?ya中,我有一个名为“dmaconf1”的表,请检查您是否在数据库中执行查询-您可以在查询之前添加
USE
,Hello mam我收到此错误datediff函数导致溢出。分隔两个日期/时间实例的DatePart数量太多。尝试将datediff与不太精确的datepart一起使用。
t1 totalduration
-838:59:59 00:09:00
select timediff(max(endtime),min(starttime)) as t1,totalduration from dmaconf1 where refconfuuid ='007f40bd-ed70-4e7f-aa47-ba1ab12e5734' and userid ='Piyush_Jain'
select datediff(s,max(endtime),min(starttime)) as t1,totalduration from dmaconf1 where refconfuuid ='007f40bd-ed70-4e7f-aa47-ba1ab12e5734' and userid ='Piyush_Jain'