Mysql show offset with query
I have some data in my database
---------
| Name | Offset(only for imagine it)
---------
| Aa | 1
| Ab | 2
| Ba | 3
| Cf | 4
| As | 5
---------
when using this query
SELECT * FROM table LIMIT 1,3;
the first 3 data should be shown, Aa, Ab, Ba, with an offset like this. Now I want to select all name prefixed with a, so use this query
SELECT * FROM table WHERE Name LIKE 'a%' LIMIT 1,3;
I want to show the result of this query with an offset, how do I do that? Loop is not the solution I want.
---------
| Name | Offset(only for imagine it)
---------
| Aa | 1
| Ab | 2
| As | 5
---------
Any help is appreciated Thanks!
+3
source to share
1 answer