------------------------
| | A | |
------------------------
| | B | |
------------------------
| | C | |
------------------------ -----Page 1
| | D | |
------------------------
| | E | |
------------------------
| | F | |
------------------------ -----Page 2
| | F | |
------------------------
| | F | |
------------------------
| | G | | -----Page 3
Please excuse my ascii art, never done it before.
I have a database with the second colunm sorted as shown above. The database displays to the user in "pages" of 3 rows each.
The user is then going to seach (via a text input) for some data from the sorted second column and wants the page returned that has the first occurance of that data.
For example, the user enters "F", page 2 is returned as it contains the first occurance of F in this sort order.
For example, the user enters "C", page 1 is returned as it contains the first (and only) occurance of C in this sort order.
What is the query to do this?
My first thought is to find the row of the first occurance, calculate what page it is in and then query that page as normal. Is that the most efficient way, or is there some build in functionality.
Thank you.
-SQLite (via C++ API)
-Visual Studio 2003.NET