On 9/28/2013 7:12 PM, ChingChang Hsiao wrote:
I have 2 similar tables. If_idx and dest_addr_idx are the keys. I am trying to synchronize the rows. Is there one sql statement to delete the extra row or 2 statements to get the result for the extra if_idx, 69 and dest_addr_idx ,1 and then delete it from the table lldp_stats_tx_port_table_clear. delete from lldp_stats_tx_port_table_clear where if_idx not in (select if_idx from lldp_stats_tx_port_table); It is one statement for one key if_idx. How about use 2 keys if_idx and dest_addr_idx?
If I understand you correctly (which I'm not sure of), you are looking for something like this:
delete from lldp_stats_tx_port_table_clear where not exists ( select 1 from lldp_stats_tx_port_table t where t.if_idx = lldp_stats_tx_port_table_clear.if_idx and t.dest_addr_idx = lldp_stats_tx_port_table_clear.dest_addr_idx); -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users