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?
---------------------------------------------------------------------------------
sqlite> .d lldp_stats_tx_port_table
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE lldp_stats_tx_port_table (
if_idx INTEGER,
dest_addr_idx INTEGER,
frames_out_total INTEGER,
lldpdu_len_errors INTEGER,
UNIQUE (if_idx, dest_addr_idx) ON CONFLICT REPLACE);
INSERT INTO "lldp_stats_tx_port_table" VALUES(28,1,74,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(28,3,74,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(28,2,74,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(29,1,74,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(29,3,74,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(29,2,74,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(69,3,0,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(69,2,77,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(83,1,74,0);
INSERT INTO "lldp_stats_tx_port_table" VALUES(86,1,77,0);
COMMIT;
sqlite> .d lldp_stats_tx_port_table_clear
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE lldp_stats_tx_port_table_clear(
if_idx INT,
dest_addr_idx INT,
frames_out_total INT,
lldpdu_len_errors INT
);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(28,1,42,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(28,3,42,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(28,2,42,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(29,1,42,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(29,3,42,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(29,2,42,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(69,3,0,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(69,2,45,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(83,1,42,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(86,1,46,0);
INSERT INTO "lldp_stats_tx_port_table_clear" VALUES(69,1,0,0);
COMMIT;
This email and attachments may contain privileged or confidential information
intended only for the addressee(s) indicated. The sender does not waive any of
its rights, privileges or protections respecting this information. If you are
not the named addressee, an employee, or agent responsible for sending this
message to the named addressee (or this message was received by mistake), you
are not authorized to read, print, retain, copy or disseminate this message or
any part of it. If received in error, please notify us immediately by e-mail,
discard any paper copies and delete all electronic files of the email.
Computer viruses can be transmitted via email. The recipient should check this
email and any attachments for viruses. Email transmission cannot be guaranteed
to be secured or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or contain viruses. The sender
accepts no liability for any damage caused by any transmitted viruses or errors
or omissions in the contents of this message.
Overture Networks, Inc. 637 Davis Drive, Morrisville, NC USA 27560
www.overturenetworks.com
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users