I have a table called bug_history_table as given below
------------------------------------------------------------------------
| bug_id | date_modified | field_changed | old_value | new_value |
------------------------------------------------------------------------
| 14415 | 2015-11-03 13:52:32 | status | unconfirm | open |
| 14415 | 2015-11-04 10:50:58 | status | open | resolved |
| 14415 | 2015-11-10 11:27:41 | status | resolved | verified |
| 14415 | 2015-11-14 11:27:41 | status | verified | closed |
------------------------------------------------------------------------
The above table shows the bug history of status changed from open to closed. I want to show the results between two dates when the bug was idle i.e. status remain unchanged until its modified.
Expected Output -
--------------------------------------
| bug_id | date_modified | new_value |
--------------------------------------
| 14415 | 2015-11-03 | open |
| 14415 | 2015-11-04 | resolved |
| 14415 | 2015-11-05 | resolved | <---
| 14415 | 2015-11-06 | resolved | <---
| 14415 | 2015-11-07 | resolved | <--- Need these extra rows.
| 14415 | 2015-11-08 | resolved | <---
| 14415 | 2015-11-09 | resolved | <---
| 14415 | 2015-11-10 | verified |
| 14415 | 2015-11-11 | verified | <---
| 14415 | 2015-11-12 | verified | <--- Need these extra rows.
| 14415 | 2015-11-13 | verified | <---
| 14415 | 2015-11-14 | closed |
--------------------------------------
The entries are inserted only when bug status is modified. Now lets take example as below -
If bug is "Opened" on 2015-11-03 and then no user has updated its status till 2015-11-06 that means bug remained idle for 3 days. So I want to display that bug was in "Opened" state on 2015-11-03, 2015-11-04, 2015-11-05 these days.