Previous row's one column data

Hi everyone! :slight_smile: I am working on SQL sever 2012 and have created a form in visual studio 2013. The problem is I want to access the previous row's one particular column's data (say column B) and I want to check if it matches with today's date. If not, then I will print today's date with 01 in textbox else I will increment that number.
Please guide me on how to do this!

please provide some sample data and the expected result.

thanks

To access the column value from a previous row - you can use the LAG function. You need to define for the system what you mean by previous row - which will be done in the PARTITION BY and ORDER BY statements for LAG.

Hi! Sorry for the late reply. Yes LAG function helped me!
Thank you for your response :slight_smile: