1

Is there a way I can tell my MySQL query to start from a specific id and end at another using MySQL?

2 Answers 2

1

use where id between x and y

http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_between

update according to the remark

one option : where id =x or id = y . second option : where id in (x,y)

Sign up to request clarification or add additional context in comments.

2 Comments

what if I just want what those two ids are related too and nothing else.
one option : where id =x or id = y . 2 option : where id in (x,y)
0

Using between operator you can achieve what you want.

syntax:

SELECT * FROM your_table_name WHERE id BETWEEN 'x' AND 'y'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.