数据库学习--两个表联合查询


两个表联合查询,要求查询b表中没有的数据且在A表中有的数据。
 select a.code,a.goods_name,a.goods_model,a.amount,a.changedate,b.saleorderid,b.goodsid
 from v_sale_order a,   
 (   select    
 nvl(xmltype.extract(XML_CONTENT,'//saleOrderJudgment/@saleOrderId').getStringVal(),'') saleorderid,   
 nvl(xmltype.extract(XML_CONTENT,'//saleOrderJudgment/@goodsid').getStringVal(),'') goodsid   
 from saleorder_judgment    ) b  
 where    
 a.orderid=b.saleorderid(+) and   
 a.code=b.goodsid(+) and
 a.orderid='XSDD201006003' and (a.code !=b.goodsid or b.goodsid is null)

你可能感兴趣的:(xml)