For me, SQL and relational databases were a step backwards from what I was using in 1982 and I cursed them until I retired 3 years ago. They work because the hardware’s power overcomes the deficiencies. Try this problem with SQL: Print sales, change in sales, by item and date.

My old code:

==>SELECT Sales, Sales – LAST Sales as Change by Item, Date

You can fix the bug with this:

==>SELECT Sales, IF Item <> LAST Item, 0,Sales – LAST Sales as Change by Item, Date

William “Bill” Myers, Analyzes all, Programmer, retired. If you learn anything new, find enjoyment, have a new thought, then I’m successful. Photo: 1st article

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store