code || Name|| day||ActivityDate||TimeIn || TimeOut ||
001 || Ade || 02 || 2013-08-02 || 10:06:09 || 18:21:03 ||
001 || Ade || 03 ||2013-08-03 || 11:00:34 || 18:06:56 ||
001 || Ade || 05 || 2013-08-05 || 09:56:29 || 17:59:56 ||
002 || Ali || 01 || 2013-08-01 || 09:56:29 || 17:59:56 ||
这是我在phpmyadmin中的表..我想查询,它会像另一个表一样..
code|| Name|| 1.8TimeIn ||1.8TimeOut|| 2.8TimeIn|| 2.8TimeOut || And so on>>>
001 || Ade || NULL || NULL || 10:06:09 || 18:21:03 ||
002 || Ali || 09:56:29 || 17:59:56 || NULL || NULL ||
如果我不想查询如何使用数组,如果我使用查询,将需要很长时间才能阅读..
我的示例查询:
SELECT Name, EmployeeID,
(SELECT TimeIn FROM augustatt
WHERE EmployeeID=M.EmployeeID AND ActivityDate='2013-08-01') AS '1/8In',
(SELECT TimeOut FROM augustatt
WHERE EmployeeID=M.EmployeeID AND ActivityDate='2013-08-01') AS '1/8Out'
FROM augustatt M
GROUP BY Name,EmployeeID
ORDER BY Name