SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,063 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want difference between two time ,
Create table #conIssuance (ID int,CID varchar(50),E_Date date,E_Time Time(7),QTY int)
Insert into #conIssuance values (11101,'Saver' ,'2023-11-07','08:00',1)
Insert into #conIssuance values (11102,'Saver' ,'2023-11-07','08:10',1)
Insert into #conIssuance values (11103,'Saver' ,'2023-11-07','08:18',1)
Insert into #conIssuance values (11104,'Saver' ,'2023-11-07','08:25',1)
Insert into #conIssuance values (11105,'Army' ,'2023-11-07','08:35',1)
Output
Last row will be subtract from 8:50
Check this query:
select ID, CID, E_Date, datediff(minute, E_Time, coalesce(lead(E_Time) over (order by E_Date, E_Time), '08:50')) as Minutes
from #conIssuance
order by E_Date, E_Time
(Assuming that the time does not pass the midnight).