How do I delete duplicated data in the absen
table below?
- field table absen (date,time,id_user)
- field table employee (name,department,address,id_user)
I tried the query:
select absen.date,min(absen.time),max(absen.time),absen.id_user,employee.name
from absen,employee
where absen.id_user = employee.id_user
group by absen.tanggal having employee.id_user = '00600320' and absen.tanggal between '2015/01/01' and '2015/01/31'
order by absen.tanggal asc
I want to delete all data which is not included in this query, because employees have more than one row per day.
Example :
2015/01/01 08:00:00 00600320
2015/01/01 08:00:08 00600320
2015/01/01 08:00:15 00600320
2015/01/01 17:10:00 00600320
2015/01/01 17:00:10 00600320
2015/01/01 17:00:12 00600320
I just want take up min and max from table absen and delete all between min and max.
NB : i want delete table.