decalre @custid int
SELECT @custid=cust_id
FROM t_account
WHERE acct_number =@account_id
go
delete from t_customer
where cust_id=@custid
go
SELECT @custid=cust_id
FROM t_account
WHERE acct_number =@account_id
go
delete from t_customer
where cust_id=@custid
go
declare @account_id intdelete from t_customer
where cust_id in (select custid from t_account where acct_number=@account_id)
FROM t_account
WHERE acct_number =@account_id
select f1, f1
into NewTable
from table把查询结果写入另一个已经存在的表中
INSERT INTO archivetitles
(title_id, title, type, pub_id)
SELECT title_id, title, type, pub_id
FROM titles
WHERE (pub_id = '0766')
SELECT @custid = cust_id FROM t_account
WHERE acct_number =@account_id DELETE FROM t_customer WHERE cust_id = @custid当然可以一句搞定
delete t_customer where cust_id = (select cust_id from t_account where acct_number = @account_id)