postgresql postgres 查询计数字符并按最长长度排序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22803991/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:23:25 来源:igfitidea点击:
postgres query count characters and order by longest length
提问by LeoSam
I'm using the following query to print all title from stories table
我正在使用以下查询打印故事表中的所有标题
select title from stories;
which show me all titles , The point here how to tweak it and do the following :
它向我展示了所有标题,这里的重点是如何调整它并执行以下操作:
`order by longest title or even count longest title`
any tips
有小费吗
回答by user sflskjdf
If you to order by the length of the title (longest to shortest) you should use the following query
如果您按标题的长度(最长到最短)排序,则应使用以下查询
select title from stories order by length(title) desc