Reputation: 13
I am getting different sort order even if I have added order by clause in both the queries. Here are queries that I am executing on Teradata & snowflake-
Teradata :
Select column1, column2, column3, column4,column5 From Teradata_Table Where column1 in (1027837724,1040965189,1046224751) and column2='2021-03-11'
order by column1 ;
Result -->
column1 | column2 | column3 | column4 | column5 |
---|---|---|---|---|
1027837724 | 3/11/2021 | 0 | 42.66 | 5942 |
1027837724 | 3/11/2021 | 12052.34 | 2.99 | 5735 |
1040965189 | 3/11/2021 | 5336.72 | 10.87 | 5944 |
1040965189 | 3/11/2021 | 0 | 311.16 | 5942 |
1046224751 | 3/11/2021 | 0 | 14.99 | 5735 |
1046224751 | 3/11/2021 | 0 | 2.99 | 5735 |
Snowflake :
Select column1, column2, column3, column4,column5 From Snowflake_Tablename Where column1 in (1027837724,1040965189,1046224751) and column2='2021-03-11'
order by column 1
Result -->
column1 | column2 | column3 | column4 | column5 |
---|---|---|---|---|
1027837724 | 3/11/2021 | 12052.34 | 2.99 | 5735 |
1027837724 | 3/11/2021 | 0 | 42.66 | 5942 |
1040965189 | 3/11/2021 | 5336.72 | 10.87 | 5944 |
1040965189 | 3/11/2021 | 0 | 311.16 | 5942 |
1046224751 | 3/11/2021 | 0 | 14.99 | 5735 |
1046224751 | 3/11/2021 | 0 | 2.99 | 5735 |
Upvotes: 1
Views: 1055
Reputation: 59175
As the comments say:
If you want to make the order consistent, you should ORDER BY column1, column2, column3, etc
.
Upvotes: 2