Answers for "compare two datetime in the same minute"

SQL
1

how to get the date diff of 2 dates in the same fieldin sql server

WITH Partitioned AS(	SELECT *, ROW_NUMBER() OVER (PARTITION BY cu_id, date ORDER BY cu_id, date) AS RowNumber	FROM @Table) SELECT 	*,	CASE 		WHEN RowNumber > 1 THEN 0		ELSE COALESCE(DATEDIFF(DAY, (SELECT MAX(date) FROM @Table WHERE date < a.date AND cu_id = a.cu_id), a.date), 0)	END AS Days_betweenFROM Partitioned a
Posted by: Guest on March-24-2020

Code answers related to "compare two datetime in the same minute"

Code answers related to "SQL"

Browse Popular Code Answers by Language