Home MS SQL Server - How to generate end date for each line item
 In the table, I have emp_id, rate_effective_date and hourly_rate columns, however, there is no rate_effective_end_date column. Please help me with a query that generate rate_effective_end_date for each line item. The rate_effective_end_date will be calculated from next rate_effective_date -1 for any given employee. Emp id | rate_effective_date | hourly_rate | rate_effective_end_date --------+---------------------+-------------+------------------------ 1 | 01/01/17 | 50 | 06/29/17 1 | 06/30/17 | 55 | 09/30/17 1 | 10/01/17 | 45 | 12/31/17 1 | 01/01/18 | 60 | {null}