gpt4 book ai didi

Sqlite 联合和排序顺序

转载 作者:行者123 更新时间:2023-12-03 16:07:06 24 4
gpt4 key购买 nike

select 'none', '0'
union
select * from category where id='2'

我可以检索上述sqlite 查询的输出,因为'none' 应该始终是第一项吗?即我想阻止两个结果集的组合排序。请帮忙...

最佳答案

select * from
(
select 'none' as col1, '0' as col2 union select * from category where id='2'
) t
order by case when col1='none' then 0 else 1 end

关于Sqlite 联合和排序顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11500143/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com