запрос ниже делает счетчик часов в поле TotalOre, счет должен быть (OreFine-OreInizio) -Pausa Я считаю общее количество часов, я загрузил некоторые примеры значений ирезультат 23:30 (TotaleOre)
Входное значение:
OreFINE
2017-07-26 16:30:00:000
Oreinizio
2017-07-26 17:30:00:000
Paura(Hour.Minute)
1.3
Запрос:
select IdRisorseUmane,IdUtenteInserimento,u1.Nome+' '+u1.Cognome as InseritoDA,ExtraPreventivo,
u2.Nome+' '+u2.Cognome as Risorsa,
RisorseUmane.IdUtente,IdCantiere,
CONVERT(VARCHAR(10), Data, 105) as Data,
Descrizione,
convert(varchar(5), OreInizio, 108) as OreInizio,
convert(varchar(5), OreFine, 108) as OreFine,
REPLACE(Pausa, '.', ':') as Pausa,
convert(varchar(5),Cast(convert(varchar(5), (OreFine - OreInizio), 108) as datetime) - CAST(REPLACE(Pausa, '.', ':') as datetime), 108) as TotaleOre,
TipologiaPreventivo.NomeTipologia as Tipologia
from RisorseUmane
inner join Utente as u1 on u1.IdUtente = RisorseUmane.IdUtenteInserimento
inner join Utente as u2 on u2.IdUtente = RisorseUmane.IdUtente
inner join TipologiaPreventivo on TipologiaPreventivo.IdTipologiaPreventivo=RisorseUmane.IdTipologia