i have bit of code: ;with mycte ( select *, row_number() over(partition carduser order cardtableid) newvariation cardchecker ) update mycte set status = newvariation which updates status column, want happen on 24 hour period, status starts again next day @ 1, , counts again based on carduser specified above: current data , happens: 2 aaa 1 2015-06-25 08:00:00.000 123 1 null 3 ccc 1 2015-06-25 00:00:00.000 124 1 null 4 aaa 1 2015-06-25 17:30:00.000 125 2 null 5 aaa 1 2015-06-26 17:30:00.000 125 *3* null what want happen: 2 aaa 1 2015-06-25 08:00:00.000 123 1 null 3 ccc 1 2015-06-25 00:00:00.000 124 1 null 4 aaa 1 2015-06-25 17:30:00.000 125 2 null 5 aaa 1 2015-06-26 17:30:00.000 125 *1* null im not quite sure how add above query possible point me in right direction? the main problem eventtime field contains both date , time, adding partition means status 1 based on time parameter of field thanks ...
Comments
Post a Comment