Monday, 6 May 2013

date different in sql server


SELECT        MU.Employee_ID, LDL.Status,LDL.Login_Date as [Date] ,
CONVERT(varchar(50),LDL.Login_Date, 108) AS checkIn,
CONVERT(varchar, LDL.Logout_Date, 108) AS checkOut, MU.Register_ID,
SR.Register_Name AS WorkStation, POST.Store_Name,
 DATEADD(SECOND, 0, CONVERT(TIME(0), ('23:59:59.000' -(LDL.Login_Date - LDL.Logout_Date))))AS Result,
 DATEDIFF(ss,LDL.Login_Date,LDL.Logout_Date)AS Result_InSec

FROM            Pos.LoginDataLog AS LDL INNER JOIN
                         Pos.ManageUser AS MU ON LDL.User_ID = MU.User_ID INNER JOIN
                         Pos.StoreRegister AS SR ON MU.Register_ID = SR.Register_ID INNER JOIN
                         Pos.POS_Store AS POST ON LDL.Store_ID = POST.Store_ID

No comments:

Post a Comment