UPDATE IP SET (src_ip, vlan_id) = (SELECT DISTINCT src_ip, vlan_id FROM video_2)
This command has a syntax error. I need to use src_ip and vlan_id as a pair, since in table video_2, same src_ip may have same or different vlan_id, so I need to select unique “src_ip, vlan_id” paris out from video_2 and put them into the new IP table
Can anyone help?
When you say
"put them into a new table"do you mean that you actually want to do an insert then? (The destination table is currently empty?)If you mean that the IP table already has records in it, how do you decide which record should get which ip/vlanid combination? You need to think of it as a join first, where you can match every record that needs updating to the combination you want it updating to. If you can write it as straight SELECT (With the IP record on one side and the Veido2 record on the other), we can show you how to turn it into an UPDATE.