MYSQL - How to avoid duplicate value based on unique key and servertimestamp
<p>I am trying to write a query to update duplicate value with 0 if the two unique column's serverTimeStamp is between 15 second difference.</p>

<pre><code>id  D_Id             value serverTimeStamp
1   001               1    2016-10-05 23:37:02
2   002               1    2016-10-05 23:37:04
3   001               1    2016-10-05 23:52:24
4   002               1    2016-10-05 23:55:24
5   001               1    2016-10-06 00:29:09
6   002               1    2016-10-06 00:29:11
7   002               1    2016-10-06 01:56:51
8   001               1    2016-10-06 01:56:58 
</code></pre>

<p>Expecting output :</p>

<pre><code>id  D_Id             value serverTimeStamp
1   001               1    2016-10-05 23:37:02
2   002               0    2016-10-05 23:37:04
3   001               1    2016-10-05 23:52:24
4   002               1    2016-10-05 23:55:24
5   001               1    2016-10-06 00:29:09
6   002               0    2016-10-06 00:29:11
7   002               1    2016-10-06 01:56:51
8   001               0    2016-10-06 01:56:58
</code></pre>

<p>how to achieve this by query?</p>