Here's the table:
id | name
------+---------
10 | val1
3 | val1
5 | val1
4 | val2
1 | val2
6 | val3
8 | val3
7 | val3
9 | val3
2 | val4
The table is ordered by value column and I've to preserve this order
How can get all the rows after id=8 and name>val3 with this result?
id | name
------+---------
8 | val3
7 | val3
9 | val3
2 | val4
I've tried with query like:
SELECT FORM table WHERE id>8 AND VALUE name>'val3'
but obviously is not the result i looking for... any idea?
Edit 1:
Sorry but it isn't possible change the design of the db, and let me say that I think it's hard to say how a db is designed from a general table used to explain only a specific problem. However, yes i know the query is wrong but I need all the rows after value of the second column and FROM a certain id value... it's a bit more clear?
Edit 2:
When I say FROM a certain id value, i'm not talking about cardinal order of the id column, but i'm talking about the position after that with the id value specified
Edit 3:
Ok... I've a table ordered by name column, how can I select only last n rows? I can use eventually an id value (8 in this case) and a name value (val3 in this case)... i know it's unusual...
Edit 4:
Ok i've rewrite the question in a better way here this question is not usefull anymore please close it, thankyou for the time you've spent anyway