I have an attendance table whose structure is like this.
CREATE TABLE ATTENDANCE(
EmployeeID VARCHAR(10),
LogDate DATETIME);
Supposse following values are there in the table:
INSERT INTO ATTENDANCE VALUES('1','2014-06-25 09:30:00:00')
INSERT INTO ATTENDANCE VALUES('1','2014-06-25 13:20:00:00')
INSERT INTO ATTENDANCE VALUES('1','2014-06-25 15:40:00:00')
INSERT INTO ATTENDANCE VALUES('1','2014-06-25 18:21:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-25 08:31:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-25 14:21:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-25 16:43:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-25 19:22:00:00')
INSERT INTO ATTENDANCE VALUES('1','2014-06-26 09:30:00:00')
INSERT INTO ATTENDANCE VALUES('1','2014-06-26 13:20:00:00')
INSERT INTO ATTENDANCE VALUES('1','2014-06-26 15:40:00:00')
INSERT INTO ATTENDANCE VALUES('1','2014-06-26 18:21:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-26 08:31:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-26 14:21:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-26 16:43:00:00')
INSERT INTO ATTENDANCE VALUES('2','2014-06-26 19:22:00:00')
I want to display the data like below:
Emp ID Attendance Date Log 1 Log 2 Log 3 Log 4
1 25-04-2014 09:30:00:00 13:20:00:00 15:40:00:00 18:21:00:00
2 25-04-2014 08:31:00:00 14:21:00:00 16:43:00:00 19:22:00:00
1 26-04-2014 09:30:00:00 13:20:00:00 15:40:00:00 18:21:00:00
2 26-04-2014 08:31:00:00 14:21:00:00 16:43:00:00 19:22:00:00
Please help me frame this query.
Thanks,
Rajesh