Re: [SQL ] 如何刪除上百筆的資料?
※ 引述《Xphenomenon (啦 )》之銘言:
: 假設我有一百筆想要刪除的資料,而我知道他們的欄位,我是否可以
: 將他們存在某一個檔案裡面,然後透過 SQL 的語法一一將他們刪除呢?
: 例如:
: 序號.txt 檔案
: 466
: 789
: 316
: ...
: ...
: ...
: 649
: 777
: 334
: 以上序號.txt 檔案裡有各筆紀錄的欄位資料,我想要透過 SQL 語法將此
: 檔案讀入,進而分別刪除各筆資料,請問有辦法做到嗎?
: 謝謝各位大大的回答 :)
直覺想到的做法就是用別的語言讀檔建立出
DELETE FROM `table` WHERE (`seqno`=466 OR `seqno`=789 OR ... OR `seqno`=334)
這樣的字串 (這用個迴圈即可) 然後丟給SQL
--
印象中SQL語言好像沒有讀檔的功能...
--
'You've sort of made up for it tonight,' said Harry. 'Getting the
sword. Finishing the Horcrux. Saving my life.'
'That makes me sound a lot cooler then I was,' Ron mumbled.
'Stuff like that always sounds cooler then it really was,' said
Harry. 'I've been trying to tell you that for years.'
-- Harry Potter and the Deathly Hollows, P.308
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.30.84
推
03/09 20:21, , 1F
03/09 20:21, 1F
推
03/09 20:44, , 2F
03/09 20:44, 2F
推
03/09 23:04, , 3F
03/09 23:04, 3F
討論串 (同標題文章)