sorting - MySQL behaves strange in sort and select order by limit when rows have identical column vlaue -


i have table 6 rows of data id=11,12,13,14,15,18 after inserted row id=18 cloning id=12. select data table column (c1) , happens 6 rows have same column value. tried use select limit loop through rows c1=2;

select id table c1=2 limit 0,2 ;    

-> got 15,14

select id table c1=2 limit 2,2 ;  

-> got 13,11

select id table c1=2 limit 4,2 ;  

-> got 15, 18

how comes id=12 missing , id=15 appears twice? did miss anything? shall resort table or after insert new row ?

things happen more complicated adding order by. 6 rows have same c1 column values. if used order c1 desc, got same undesired result. 6 rows have different values on column c2. when used order c2 desc, can loop through 6 rows of data correctly. comes question - why mysql not order , return select ** order yy desc limit 2, 2 correctly when rows have identical yy column value.

of course know id different rows, don't know rows in table have different c1 value (which used in order by) or not. shall if need order c1 ?


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -