sql - round a version in PostgreSQL -


i need round off version column , round() works decimal, doesn't works on 7.3.1

dbtype        version ------------------------ postgresql     7.3.1 oracle         11.2.0.4.0 oracle         12.4.5 

my desired output

postgresql 7 oracle     11 oracle     12 

you convert array:

select dbtype, (string_to_array(version, '.'))[1] the_table 

or use split_part:

select dbtype, split_part(version, '.', 1) the_table 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -