I am currently working on a project that is looking at having a database that will store only 2 rows of data in it. This database will have new rows added to it all the time and the top row will be deleted when a new row is entered making sure there are always 2 rows.
What I am looking to do is to compare the top row of data and the bottom row of data and then store the data that is different in variables. I only want to store the data that is different from the bottom row as the top row will always be the oldest sets of data and I would no longer need to handle that.
I can do this all on the C# side but I was wondering if there is a way to do most of this on the SQL side of things? Thanks for the help 🙂
thanks for the clearification, let assume this table:
then this stored procedure should do the trick