Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello Friends, I have a stored procedure to get the employee details. The stored procedure looks like as follows:declare @FromDate DATETIMEset @FromDate = '2009-08-01'declare @ToDate DATETIME set @ToDate = '2009-11-24'declare @EmpId varchar(15) set @EmpId = 'YR'select LoginTime, LogOutTime, right(('00' + convert(varchar,diffSeconds/(3600))),2) + ':'+right(('00'+ convert(varchar,diffSeconds%(3600)/60)),2)+':'+ right(('00'+convert(varchar,diffSeconds%60)),2) as 'Time Spent' from loginsWHERE EMPID = @EmpIdand LoginTime >= @FromDateAND LoginTime < @ToDateorder by loginTimeThe above procedure is showing more than one entry on a date if an employee logs in for more than one time on that date. Is it possible to add multiple login time on a date and show only one record for a date (no matter how many times employee logs in on that date)Can check the image : http://i789.photobucket.com/albums/yy178/amodi/TEMP.jpgThanks.
Sachin.Nand
2937 Posts
Posted - 2009-12-02 : 04:06:57
Should it be the minimum login time or the maximum login time for the day that you want to display having multiple login time?PBUH
amodi
Yak Posting Veteran
83 Posts
Posted - 2009-12-02 : 04:16:15
quote:Originally posted by Idera Should it be the minimum login time or the maximum login time for the day that you want to display having multiple login time?PBUH
Hello Idera, It should be maximum login time.
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2009-12-02 : 05:03:33
this will sum up the time spend for each login-logout session