Postgresql Sort Text Column As Integer

Hi all. This article about sorting text or varchar column as integer. If you want to do this with default order by command, result is not what you want. Default text type column sorting works as alphabetical order and text length. And this article shows you, how you can handle with this.

Code

How

This code line recieves xColumn from xTable and sorts as integer value.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store