问题
How to select integer values only from a varchar column in PostgreSQL?
If the column contains:
abc
70
3g
71
1.5
I'd like to select only:
70
71
I'm struggling to find functions like: is_numeric, is_integer, to do something like this:
SELECT column
FROM table
WHERE isinteger(column)
Any ideas? Thank you.
回答1:
SELECT column
FROM table
WHERE column ~ '^\d+$'
来源:https://stackoverflow.com/questions/15163793/how-to-select-integer-values-only-from-a-varchar-column-in-postgresql