pg数据库id是vachar类型,需要按照数字大小排序
pg数据库id是vachar类型,需要按照数字大小排序
select * from table order by id;
直接拿order by id条件排序,会出现1002排在10019后面
应该将id转化成int类型再排序,修改结果如下:
select * from table order by cast(id,integer);
本文来自博客园,作者:lsblk0402,转载请注明原文链接:https://www.cnblogs.com/lsblk0402/p/18157127/varchar_sort