Hi SSCertifiable thanks for the comment here is the query;
CREATE TABLE EMPTMS
(Uidfirstname varchar (50),
Uid1lastname varchar(50),
Reader int,
dtdate datetime
);
INSERT INTO EMPTMS
(uidfirstname,uidlastname,reader,dtdate)
VALUES ('001','Alvin','1','2013-09-20 6:30:000 ')
INSERT INTO EMPTMS
(uidfirstname,uidlastname,reader,dtdate)
VALUES ('001','Alvin','2','2013-09-20 17:50:000 ')
INSERT INTO EMPTMS
(uidfirstname,uidlastname,reader,dtdate)
VALUES ('002','Rebecca','1','2013-09-20 22:10:000 ')
INSERT INTO EMPTMS
(uidfirstname,uidlastname,reader,dtdate)
VALUES ('003','Aliyah','1','2013-09-20 9:08:000 ')
INSERT INTO EMPTMS
(uidfirstname,uidlastname,reader,dtdate)
VALUES ('002','Rebecca','2','2013-09-21 7:30:000 ')
*VIEWS
CREATE VIEW AS TMS
(Select uidfirstname as empid, uidlastname
as empname, convert ( varchar,dtdate,101 ) as logdate,
, case when reader = 1 then
Convert ( varchar,dtdate,108 )
Else null end as timein,
case when reader =2 then
Convert (varchar,dtdate,108)
Else nullend as timeout
From emptms
Group by uidfirstname,uidlastname,dtdate,
reader
)
for final result query,
SELECT EMPID,EMPNAME,
LOGDATE, MIN(TIMEIN),
MAX(TIMEOUT)
FROM TMS
basically that is the table, i create view and then create query
for the output.
thanks.