Closed GoogleCodeExporter closed 9 years ago
> I expect rows inserted
You mean you expect that the "select" statement, without using "order by",
returns the rows in a specific order? That's not guaranteed, whatever you do.
You need to change your expectation.
Original comment by thomas.t...@gmail.com
on 18 Mar 2015 at 6:51
Please see the "... ORDER BY AFLD;" in step 5.
I expect rows be inserted in the order returned by the select.
Original comment by software...@gmail.com
on 18 Mar 2015 at 1:06
The issue tracker is not questions, it is for confirmed issued, and this here
is not.
Well the final "6. SELECT * FROM TESTBUG2;" does not have an "order by", and
that's the problem.
It doesn't matter in what "order" you insert rows. If the "select" statement at
step 6 does not have an "order by", then the order of the result of that query
is undefined. This is not just H2, it applies to SQL in general (to almost all
databases).
If you are not happy with that, please ask a question at StackOverflow.com.
Original comment by thomas.t...@gmail.com
on 18 Mar 2015 at 1:13
Thanks for your answer.
I appreciate so much your work. Really.
Maybe I don't be clear enough:
Let us replace 6. by
6'. SELECT * FROM TESTBUG2 ORDER BY PKFLD;
According to the "ORDER BY" when rows were inserted, and the PKFLD values
generation, rows from TESTBUG2 becomes a sequence of AFLD. That's 6' must shows
AFLD sorted automatically because was sorted by PKFLD.
Original comment by software...@gmail.com
on 18 Mar 2015 at 1:23
OK, I think I understand now what you want. Again, it would be better if you
used the mailing list or StackOverflow. Please do that next time.
The "order by" is done after the query itself.
You probably want to use this:
SELECT SET(@PKFLD_VALUE, @PKFLD_VALUE + 1), AFLD FROM (SELECT AFLD FROM SRCBUG
ORDER BY AFLD);
Original comment by thomas.t...@gmail.com
on 18 Mar 2015 at 1:32
Original issue reported on code.google.com by
software...@gmail.com
on 17 Mar 2015 at 3:55