You must Sign In to post a response.
  • Category: ASP.NET

    Previous row date column update

    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
  • #769611
    Hi

    You can follow this steps for your issue


    /* 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.

  • #769683
    you can write insert trigger on the relevant table that, as soon as insert happens then immediately update completed_date with newly inserted assigned_date.
    Thanks!
    B.Ramana Reddy


  • Sign In to post your comments