Reputation: 104
I have a HTML table like below, (that's the MySQL query dump of all the ID's)
200 201 203 204 205 206 207 208 209 210 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 302 303 305 306 307
It is in the MySQL database like
-------------------
ID Number
202 242
202 243
202 244
202 245
202 ...
-------------------
The Number
column is the above listed table, that's the HTML page. I pasted that because to better understand what my question is.
My MySQL query to get the next 10 row's value is:
SELECT Number FROM MyDB WHERE ID=202 ORDER BY Number ASC LIMIT 241 , 10
I am in the understanding that the above LIMIT 241
displays the rows with values next to 241.
The problem with the above query is it doesn't output the next 10 immediate values.
It produces,
454
455
456
457
458
459
460
461
462
Instead it must output,
241
242
243
...
That's the next immediate value.
Why it is not outputting the immediate next 10 value? and instead some other 10 values?
What would the SQL query be to output the next 10 immediate rows' values when an ID value is used to query the DB's table?
Upvotes: 0
Views: 324
Reputation: 1269873
The offset is the number of rows to skip; it has nothing to do with values in the rows. I think you want:
SELECT Number
FROM MyDB
WHERE ID = 202 AND number >= 241
ORDER BY Number ASC
LIMIT 10
Upvotes: 2