由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Quant版 - sort two same tables SQL but different results (转载)
相关主题
SQL copy a table into a new table and add a new column (转载)SQL combine two columns from two different tables no shared (转载)
SQL check likeness between two large tables (转载)SQL fast search in a 10 million records table (转载)
error of executing SQL query of string concatenationcreate table on SQL server from python pyodbc
SQL add some columns into a table from another table (转载How to write this query in Oracle?
compare two large tables SQL (转载)C++里面实现类似Excel的Pivot Table
SQL find distinct values in large table (转载)Pivot table SOS (转载)
SQL run a stored procedure by fetching from a cursor row by (转载)SQL, investment firm recruiter发过来的面试题 (转载)
keep group of values of SQL procedure in one table (转载)[合集] 如果只是programmer也是经常加班的吗
相关话题的讨论汇总
话题: 81话题: col1话题: 3498话题: 2349话题: 6742
进入Quant版参与讨论
1 (共1页)
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
1 (共1页)
进入Quant版参与讨论
相关主题
[合集] 如果只是programmer也是经常加班的吗compare two large tables SQL (转载)
[合集] 想问个职业规划的问题~SQL find distinct values in large table (转载)
[合集] Front-Offce, Mid-Office and Back-Office区别在那?SQL run a stored procedure by fetching from a cursor row by (转载)
Help: learning SQLkeep group of values of SQL procedure in one table (转载)
SQL copy a table into a new table and add a new column (转载)SQL combine two columns from two different tables no shared (转载)
SQL check likeness between two large tables (转载)SQL fast search in a 10 million records table (转载)
error of executing SQL query of string concatenationcreate table on SQL server from python pyodbc
SQL add some columns into a table from another table (转载How to write this query in Oracle?
相关话题的讨论汇总
话题: 81话题: col1话题: 3498话题: 2349话题: 6742