[SQL]時間相減的問題
想請問各位我時間格式都是datetime
我下的指令是
SELECT gg1.GPS_Date, gg1.Car_no, gg1.GPS_Latitude, gg1.GPS_Longitude,gg2.GPS_Date, gg2.Car_no, gg2.GPS_Latitude, gg2.GPS_Longitude,convert(VARCHAR(10),
max((convert(datetime ,gg2.GPS_Date, 108))-(convert(datetime ,gg1.GPS_Date, 108))), 108)as maxtime
FROM gg1,gg2
where gg1.Car_no=gg2.Car_no
and year(gg1.Car_no )=year(gg2.Car_no )
and month(gg1.Car_no )=month(gg2.Car_no )
and day(gg1.Car_no)=day(gg2.Car_no)
group by gg1.GPS_Date, gg1.Car_no, gg1.GPS_Latitude, gg1.GPS_Longitude,gg2.GPS_Date, gg2.Car_no, gg2.GPS_Latitude, gg2.GPS_Longitude
ORDER BY gg1.Car_no
他出現從字元字串轉換到 datetime 時,轉換失敗。
請問為什們會這樣
請各位救援一下
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.68.164.62