I am working with a TABLE, need logical help.
Check the below URL for the table structure and sample data.
http://sqlfiddle.com/#!2/6da1ce/2
I am trying to fetch records after a specific value.
Check the following:
My db has the following datas.
Id ---- Value
1 3
2 6
3 7
4 8
5 9
6 2
7 3
I am searching for the value 7, after the appearance of 7 in Id 3, I want to search for the next ID's after that such as 8,9,2,3.
I am trying to write a query to get the records after the first appearance of 7.
I tried the following:
SELECT * FROM TABLE
WHERE id > (SELECT id FROM TABLE WHERE value = 7
limit 1)
in my case:
SELECT * from journal
WHERE journal_id > (SELECT journal_id from journal WHERE id = 7
limit 1)
How can I write this in single Query:
I know only the value from where the search should begun.
Can I search using limit instead of mentioning Unique ID? Also can I get the remaining search in DESC order?