Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 如何用sql编写此查询?关于时间差_Asp.net_Sql - Fatal编程技术网

Asp.net 如何用sql编写此查询?关于时间差

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'

此格式的数据类型为“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'  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'