作者jonce007 (汪汪)
看板Database
标题Re: [SQL ] 如何select 出1到x之间的空号呢?
时间Sat Oct 15 04:16:42 2011
※ 引述《iFEELing (ing)》之铭言:
: 我比较好奇 既然原始资料已经被干掉了,你怎麽知道哪个号码实际上被干掉的原因是啥
那是使用者的问题,跟程式无关。也许会要求整批填上"测试删除...etc"之类吧
: : 一个暂时的想法,如果这件事只需要做一次的话,或许可以这样
: cretea table t2(
: (
: ID int
: );
: 在 T2 中 insert 数列 , ID=1 , ID=2,ID=3......ID = x;
: 然後
: select id from T2 where ID not in (select id from T1)
:
感谢回答,
我最後的想法:。作一个 temp table 如上的。
create table temp(id int);
insert into temp(id) values(1,2,3,4,.......x);
create table t2 (id int, why text);
insert into t2 (id)
select id from temp where id not in (select id from t1);
另外maplenote大大直接回至本人信箱,亦十分感谢。
信里提到,"程式还不是都要改,直接加上isdelete....."
我顺便在这回应一下。这只是个总号管理的table。
实际上不同的单据,有不同的资料管理画面、报表。约有30个左右。
而作废(删除),只有一个地方。
修改:作废。并加上作废清单与理由update。共计:修1加1
加栏位的方式,恐怕要改60以上的地方。
以上。谢谢各位大大的回答。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.161.69.99