我有3個表
選擇MYSQL出席
**User**<br>
**ID | name | npm | dept | created**
1 | TOTOK HERDIYANTO | NULL | 24 | 2016-01-12 09:05:13
5 | BIMA BRAHMANA | NULL | 24 | 2016-01-12 09:05:13
7 | IDA FARIDA | NULL | 24 | 2016-01-12 09:05:13
30 | AHMAD MAULANA | NULL | 23 | 2016-01-12 09:05:13
47 | DINI GANDINI PURBANINGR| NULL | 24 | 2016-01-12 09:05:13
58 | ANWAR JAYANINGRAT | NULL | 23 | 2016-01-12 09:05:13
86 | Yudia Natakusuma | NULL | 24 | 2016-01-12 09:05:13
96 | DENNY GANJAR P | NULL | 23 | 2016-01-12 09:05:13
106 | NOFI FIRDIYARTI | NULL | 24 | 2016-01-12 09:05:13
108 | RIAMA MILA THERESIA | NULL | 22 | 2016-01-12 09:05:13
118 | PRATIWI KUSUMA DEWI | NULL | 24 | 2016-01-12 09:05:13
126 | Shindi Azalika Nur Fala| 08.1014.022| 22 | 2016-01-12 9:05:13
128 | M. Bayu Edigani Putra | NULL | 22 | 2016-01-12 09:05:13
143 | Ardini Yati | 08.0914.020| 22 | 2016-01-12 09:05:13
150 | Dhenaldi Savirio Firman| NULL | 22 | 2016-01-12 09:05:13
153 | Rakha Prisma Ardyan | NULL | 22 | 2016-01-12 09:05:13
154 | Trisna Darapuspa | NULL | 22 | 2016-01-12 09:05:13
**Department**
**ID | name**
25 | Finance
23 | ICT
22 | Marketing
24 | SDM, Umum dan Legal
**attendance**
**userID | date | in | out**
1 | 2015-01-12 | 09:05:13 | 17:30:02
7 | 2015-01-12 | 09:05:13 | 17:30:02
30 | 2015-01-12 | 09:05:13 | 17:30:02
47 | 2015-01-12 | 09:05:13 | 17:30:02
58 | 2015-01-12 | 09:05:13 | 17:30:02
86 | 2015-01-12 | 09:05:13 | 17:30:02
106 | 2015-01-12 | 09:05:13 | 17:30:02
108 | 2015-01-12 | 09:05:13 | 17:30:02
118 | 2015-01-12 | 09:05:13 | 17:30:02
126 | 2015-01-12 | 09:05:13 | 17:30:02
128 | 2015-01-12 | 09:05:13 | 17:30:02
143 | 2015-01-12 | 09:05:13 | 17:30:02
150 | 2015-01-12 | 09:05:13 | 17:30:02
153 | 2015-01-12 | 09:05:13 | 17:30:02
154 | 2015-01-12 | 09:05:13 | 17:30:02
我想我的結果,如:
**where**
date = 2015-01-12 // yyy-mm-dd
deptid = in(23,24)
**RESULT**
**userID | date | in | out**
1 | 2015-01-12 | 09:05:13 | 17:30:02
5 | 2015-01-12 |
7 | 2015-01-12 | 09:05:13 | 17:30:02
47 | 2015-01-12 | 09:05:13 | 17:30:02
58 | 2015-01-12 | 09:05:13 | 17:30:02
86 | 2015-01-12 | 09:05:13 | 17:30:02
96 | 2015-01-12 |
106 | 2015-01-12 | 09:05:13 | 17:30:02
118 | 2015-01-12 | 09:05:13 | 17:30:02
153 | 2015-01-12 | 09:05:13 | 17:30:02
154 | 2015-01-12 | 09:05:13 | 17:30:02
出勤和用戶表之間沒有關係,規範表正常出勤和用戶表之間的關係 –
是user.ID = attendance.userID –