How do I convert an integer to string as part of a PostgreSQL query?

后端 未结 3 1893
别跟我提以往
别跟我提以往 2020-12-13 03:19

How do I convert an integer to string as part of a PostgreSQL query?

So, for example, I need:

SELECT * FROM table WHERE  = \'stri         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 03:41

    You can cast an integer to a string in this way

    intval::text
    

    and so in your case

    SELECT * FROM table WHERE ::text = 'string of numbers'
    

提交回复
热议问题