Say you have a table in PostgreSQL 11 with sets of values something like this below.
12 18 11 12 5 12 9 18 7 19 14 18 11 16 6 12 4 11 5 9
Is there a way to do a select without using sub-selects or select by using functions or trigger/functions to find where each value is lower than previous or could be higher than previous but this example is lower than previous (could be 2 row or 15+ rows) in both column and first column went higher than last row or both first and second column to terminate the select making the condition positive?
I do not know of a way to have present variables inside of a select. If I could keep a look back variable then I should be able to do this. I am wondering if anyone out there has ever come across this and made it work inside a select or they went outside of the database into GoLang / Python / C++ / Perl / PHP / etc. Very simple to do once I leave the database but I would really like to keep this inside PostgreSQL 11.