Lets say I have a postgres table with the following data:
hostname | ip
---------+--------
a1 | 198.162.4.2
a1 | 198.162.7.5
a2 | 10.43.243.4
a3 | 10.3.1.1
I want to copy the values from table tmp to table abc in psql. I want to have an sql insert command to display the hostname_ip in hostname column like below:
hostname | ip
---------+--------
a1_198.162.4.2 | 198.162.4.2
a1_198.162.7.5 | 198.162.7.5
a2_10.43.243.4 | 10.43.243.4
a3_10.3.1.1 | 10.3.1.1