You must Sign In to post a response.
  • Category: SQL Server

    Previous row date column update, based on current row date

    Hi,

    I have single record with assigned_date as '2018-06-18 10:35:01.163' and completed_date as 'NULL'.

    My requirement is:

    When another new record gets inserted, assigned_date is '2018-06-18 11:35:01.163' and completed_date is 'NULL'.

    I want a sql query where the immediate previous record completed_date should be update with newly inserted assigned_date. i.e previous record completed date should become as '2018-06-18 11:35:01.163'.



    Regards,
    Ayesha
  • #769612
    /* step 1
    First Select previous record before inserted retrieve ID
    after insert updated corresponding id related data
    */

    /*step2

    Given update statment in your where statment take previoud records and update related data

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments