比如:我写一个信息库,有如下几个表,公司信息,人才招聘,公司动态,供求信息,产品展示等等
每个公司注册后就可发布相关信息,并把公司ID号(唯一的)写入其它各个表中的COMID字段,关联,那么如果我要删除这个公司,比如这个公司的ID是5,我删除的时候要把其它各个表中的所有COMID字段为5的删除,或者,我要删除3,4,5,6,7,8的公司,同时要把其它各个表中所有COMID为3,4,5,6,7,8的记录删除,请问如何用一条SQL实现
以下是我失败的语句:
1
delete from info,JOB,product where COM_id in ("&id&")
2,成功的写法,但是用了多条
Application("Conn").Execute "delete from INFO where id in ("&id&")"
Application("Conn").Execute "delete from JOB where COM_ID in ("&id&")"
Application("Conn").Execute "delete from PRODUCT where COM_ID in ("&id&")"
Application("Conn").Execute "delete from SMINFO where COM_ID in ("&id&")"
Application("Conn").Execute "delete from NEW where COM_ID in ("&id&")"
Application("Conn").Execute "delete from productclass where COM_ID in ("&id&")"