Lets say I have two tables:
table english which has two columns, id and letter:
1,a
2,b
3,c
table greek which has two columns, id and letter:
1,alpha
2,beta
3,gamma
Ok so I execute the query select * from english limit 1,5
and i get:
2,b
3,c
Which is what I would expect. Now I try select english.id,english.letter,greek.letter from english join greek on greek.id=english.id order by english.id asc limit 1,5
2,b,beta
3,c,gama
1,a,alpha
2,b,beta
3,c,gama
What!? why is this set circular? Ok well, this next query works as I would expect:
select english.id,english.letter,greek.letter from english join greek on greek.id=english.id group by english.id order by english.id asc limit 1,5
2,b,beta
3,c,gama
So what the hell is going on here? Why do I need to add the group by english.id for the set to behavior like I would expect?
Probably you have duplicate rows in your
greektable.It works fine when I try it on MySQL 5.5.20: sqlfiddle.
Here’s an example where I have deliberately inserted duplicate rows in the
greektable and it gives exactly the same results as you get: sqlfiddle