當然不是大表的解決方案,而是自動增量不同。 您可以使用某個特定事件的cron作業自動執行此操作,或者如果您在特定表中顯示一個值,該cron作業將查看,清除並開始它。
CREATE TABLE charlie1
( billybob INT NOT NULL,
birthdate DATETIME NOT NULL,
funny_num FLOAT NOT NULL
)ENGINE=INNODB;
INSERT INTO charlie1 (billybob,birthdate,funny_num) VALUES (1,'2006-01-02',28832.123);
INSERT INTO charlie1 (billybob,birthdate,funny_num) VALUES (2,'2004-09-02',18832.888);
INSERT INTO charlie1 (billybob,birthdate,funny_num) VALUES (3,'2006-07-03',28332.123);
INSERT INTO charlie1 (billybob,birthdate,funny_num) VALUES (4,'2006-01-02',28852.777);
SELECT billybob,birthdate,funny_num
FROM charlie1
ORDER BY billybob
INTO OUTFILE '/tmp/charlie1.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
CREATE TABLE charlie2
( billybob INT NOT NULL,
birthdate DATETIME NOT NULL,
funny_num FLOAT NOT NULL
)ENGINE=MYISAM;
INSERT INTO charlie2 (billybob,birthdate,funny_num) VALUES (1,'2006-01-02',28832.123);
INSERT INTO charlie2 (billybob,birthdate,funny_num) VALUES (2,'2004-09-02',18832.888);
INSERT INTO charlie2 (billybob,birthdate,funny_num) VALUES (3,'2006-07-03',28332.123);
INSERT INTO charlie2 (billybob,birthdate,funny_num) VALUES (4,'2006-01-02',28852.777);
SELECT billybob,birthdate,funny_num
FROM charlie2
ORDER BY billybob
INTO OUTFILE '/tmp/charlie2.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
i changed data in the file to show diff picks it up:
[email protected]:/tmp# diff /tmp/charlie1.csv /tmp/charlie2.csv
2c2
< "2","2004-09-02 00:00:00","18832.9"
---
> "2","2004-09-02 00:00:00","18832.8"
德魯,這是一個很好的答案,但我不認爲我足夠具體:我在WPF C#.NET中編寫此應用程序。如果可能的話,我寧願如果答案不太依賴於數據庫引擎。有沒有辦法做到這一點,而不是逐行,在.NET中通過值比較值? – kformeck
改變這個問題,我會再去看看它。通常有多少排 – Drew
德魯,我編輯了問題,請讓我知道如果問題需要更多的澄清。 – kformeck