Home > database >  Mysql versions of query results in different problems
Mysql versions of query results in different problems

Time:09-17

Select
A.h ost_name hostname,
R1 Round (a.r ecord/10000, 2),
Round (b.r ecord/10000, 2) R2,
Round (a.r ecord/b.r ecord * 100, 0) S
The FROM
(select
Day_no, host_name, sum (record) record
The from t_keywords_topic_class_host1
WHERE
Day_no='20190716' and data_type='3 g'
Group by
Host_name day_no, data_type
The ORDER BY record desc limit 10) a
Left the join
(select host_name, sum (record) record
The from t_keywords_topic_class_host2
Where day_no='20190716' and data_type='3 g'
Group by day_no, data_type, host_name) b
On a.h ost_name=b.h ost_name;

Mysql version: 5.5.56
The query result to the R1 descending order:

But 5.6.14 version online query results R1, R2, S is out-of-order, why?

CodePudding user response:

You are using innodb storage, and then add a try with the same primary key,
Not set the primary key, innnodb generate its own primary key, may not be the same

CodePudding user response:

Version, optimization strategy is different, if not the order by, there will be a different sort of
So according to sequence output, must add order by

CodePudding user response:

No sorting, return the result of sequence, are not sure, and version has nothing to do,
  • Related