stored procedures - Sql Server: Compare multiple dates, remove duplicates and add new column all in one -
what best solution following problem? so have stored procedure inserts temporary table information so: id | name | date | age | bin |status| description | warn1 ----------------------------------------------------------------------- 01 | abcd |2016-01-01 15:00:00| 17 | 0 | 40 | done | 0 01 | abcd |2016-01-01 11:00:00| 17 | 0 | 30 | waiting | 0 01 | abcd |2016-01-01 10:00:00| 17 | 0 | 10 | started | 0 02 | zxcv |2016-01-02 11:30:00| 18 | 0 | 35 | error | 0 02 | zxcv |2016-01-02 11:00:00| 18 | 0 | 30 | waiting | 0 02 | zxcv |2016-01-02 10:00:00| 18 | 0 | 10 | started | 0 03 | yttr |2016-01-02 12:30:00| 16 | 0 | 30 | waiting | 0 03 | yttr |2016-01-02 10:00:00| 16 | 0 | 10 | no desc | 0 04 | huuo |2016-01-02 11:30:00| 17 | 0 | 40 | done | 0 04 | huuo |2016-01-02 09:00:00| 17 | 0 | 30 | waiting