Reputation: 513
I have a SQL like this:
select a.*, (@r := @r+1) as seq
from (
....
order by xx asc
) as a
join (select @r:=0) as y
I used to use MySQL, and this SQL ran just fine.
Unfortunately, when I migrate to MariaDB,
this SQL produces wierd results.
The results aren't in the correct order.
The "order by
" clause seems to be ignored...
Anybody knows why?
Upvotes: 0
Views: 600
Reputation: 142366
The SQL standard says it is OK. More Info.
One solution (as mentioned above) is to set optimizer_switch='derived_merge=off'
.
Upvotes: 1