I need to Subtract the datetime type data for example from a column like:
datetime
20/03/2013:03:17:43
20/03/2013:03:17:43
20/03/2013:03:17:44
20/03/2013:03:17:44
20/03/2013:03:17:44
20/03/2013:03:17:44
I am using SQL Server R2 2008; with my Query like:
SELECT basescore,
MAX(datetime) - MIN(datetime)
FROM log
GROUP BY basescore
But all the time it gives me an error:
Msg 8117, Level 16, State 1, Line 3
Operand data type varchar is invalid for subtract operator.
Can somebody help me solving this error? Thanks in advance!