I'm doing a query in sqlserver 2000, I have two datetime columns (start, end). I need to subtract the two columns to know how many minutes passed between the start and the end, something like:
select end-start as time_wait from myTable
help please
I'm doing a query in sqlserver 2000, I have two datetime columns (start, end). I need to subtract the two columns to know how many minutes passed between the start and the end, something like:
select end-start as time_wait from myTable
help please
More clear, it would be something like this:
SELECT
Inicio,
Fin,
DATEDIFF(minute, Inicio, Fin) as [MinutosTranscurridos]
FROM TuTabla
For this you must use the function DATEDIFF
:
SELECT DATEDIFF(MINUTE,Inicio,Fin)
FROM dbo.TuTabla;