l******9 发帖数: 579 | 1 【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: sort two same tables SQL but different results
发信站: BBS 未名空间站 (Fri May 9 09:57:41 2014, 美东)
I am sorting two tables on SQL.
The two tables have the same column names and types and rows numbers.
I used order by to do sorting but the two tables are different in order.
Example,
SELECT *
FROM table1 AS t1
ORDER BY t1.col1 , t1.col2, t1.col3, t1.col4 ASC
SELECT *
FROM table2 AS t2
ORDER BY t2.col1 , t2.col2, t2.col3, t2.col4 ASC
Table1 is :
col1 col2 col3 col4
80 790 3498 18654.064361
81 589 3182 2138518.05404
80 518 6742 64613189.0485
81 649 2349 26163.054218
Table2 is :
col1 col2 col3 col4
81 589 3182 2138518.05404
80 518 6742 64613189.0485
80 790 3498 18654.064361
81 649 2349 26163.054218
The sorted results are :
Table1 is :
col1 col2 col3 col4
80 518 6742 64613189.0485
80 790 3498 18654.064361
81 589 3182 2138518.05404
81 649 2349 26163.054218
The sorted results are :
Table12 is :
col1 col2 col3 col4
81 589 3182 2138518.05404
81 649 2349 26163.054218
80 518 6742 64613189.0485
80 790 3498 18654.064361
Why they are different on col1 ?
Thanks |
|