关于SQL数据导入到另一个表
我想加一个条件,就是当shop_products我指定的四个表:bookname,huiyuanjia,isbn,bookchuban,导入到Purchaseprices表中对应的字段,但有一个条件:
当shop_products表bookname中一个值的在表Purchaseprices中的PurchaseName中存在,就不导入,这样的写法如何写
<%
if request("action")="save" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from shop_products,Purchaseprices "
rs.open sql,conn,1,3
sql="insert into Purchaseprices.PurchaseName select * from shop_products.bookname"
sql="insert into Purchaseprices.PurchaseRetail select * from shop_products.huiyuanjia"
sq="insert into Purchaseprices.PurchaseSpecifications select * from shop_products.isbn "
sql="insert into Purchaseprice.PurchaseUnits select * from shop_products.bookchuban "
rs.close
set rs=nothing
response.write "<script language=javascript>alert('导入完成!');window.location.href='pro.asp';</script>"
response.End
end if
%>