更新时间:2023-02-03 09:00:09
因为该数字最多可以是15位数字,将强制转换为64位(8字节)整数。试试这个:
Because the number can be up to 15 digits, you'll meed to cast to an 64 bit (8-byte) integer. Try this:
SELECT * FROM table
WHERE myint = mytext::int8
::
强制转换运算符具有历史意义,但很方便。 Postgres还符合SQL标准语法
The ::
cast operator is historical but convenient. Postgres also conforms to the SQL standard syntax
myint = cast ( mytext as int8)
如果您有文字文本,则想与 int进行比较
,将 int
转换为文本:
SELECT * FROM table
WHERE myint::varchar(255) = mytext