sir
i want to show off days in my report
my sql data is like this
date----------timein------timeout--shift----------eid
2-May-2013--9:20AM---6:17PM-----G-----------17090
3-May-2013--9:09AM---2:01PM-----G-----------17090
4-May-2013--9:03AM---10:41AM----G-----------17090
sql data does...
this is my data
-------------------------row 1--------------------------row 2
date-------------2013-01-04 00:00:00.000-------2013-01-04 00:00:00.000
eid--------------26446-----------------------------26446
timein-----------2013-06-11 09:44:00.000-----2013-06-11 13:56:00.000...
sir this query give me first time in and last time out result
SELECT a.eid, a.date, d.InTime, e.OutTime
FROM
(SELECT DISTINCT eid, date FROM atend) a
OUTER APPLY (SELECT b.eid, b.Date, MIN(b.Time) InTime FROM atend b WHERE a.eid = b.eid AND a.date = b.date GROUP BY b.eid, b.Date) d
OUTER APPLY...
Dear imex
query give me this result
eid--------------date--------------------timein-----------------------------timeout
886------2013-01-01 00:00:00.000---2013-06-10 08:07:00.000---2013-06-10 20:09:00.000
but actual data is this...
my data is like this
eid-----------date------------------------------time--------------------------status
26359---2013-01-01 13:00:00.000------2013-01-01 09:50:00.000--------IN
26359---2013-01-01 13:00:00.000------2013-01-01 11:47:00.000--------OUT
26359---2013-01-01...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.