snowflake - 排序不正确
snowflake - Order by not sorting correctly
我是 运行 snowflake 中的一个查询,带有 group by 和 order by 子句,我注意到它没有按升序对第一列进行排序
select distinct columnA from table order by columnA
ColumnA
------------ +
AMP 1
AMP 2
Aluminum
Apple
在示例中,铝应排在第一行,但它落在了第三行。在我看来,排序中有大写和小写的优先级。我怎样才能使第 3 行成为第一行?
上限高于下限。
不管大小写,这将排序:
with data as (select * from table(split_to_table('AMP 1
AMP 2
Aluminum
Apple', '\n')))
select distinct value
from data
order by lower(value);
我是 运行 snowflake 中的一个查询,带有 group by 和 order by 子句,我注意到它没有按升序对第一列进行排序
select distinct columnA from table order by columnA
ColumnA
------------ +
AMP 1
AMP 2
Aluminum
Apple
在示例中,铝应排在第一行,但它落在了第三行。在我看来,排序中有大写和小写的优先级。我怎样才能使第 3 行成为第一行?
上限高于下限。
不管大小写,这将排序:
with data as (select * from table(split_to_table('AMP 1
AMP 2
Aluminum
Apple', '\n')))
select distinct value
from data
order by lower(value);