I’m having trouble doing the following in SQL with Postgres. My program has an ordered set of numbers. In my database I have the table which stores all numbers in rows with extra data. These rows are also placed in order.
For example my set I need to find is;
1,5,6,1,3
The database has rows
row1 4
row2 5
row3 1
row4 5
row5 6
row6 1
row7 3
row8 2
row9 7
In the example above it’s easy to see that my set is found from row 3 to to row7. Still doing such in SQL is a mystery to me. I’m reading some articles regarding pivot tables, still I’m hoping there’s an easier way.
Both data-sets need to have fields that identify the order.
And provided that the ordering column is a sequential consecutive set of numbers, then this is possible, although I doubt it’s very quick.
Then this query…