这条sql有没办法优化,这样写查下太慢了;求大神指教
selectbarcodefromgoods_barcodewhereConCat(goods_id,color_id,size_id)in(selectConCat(g...
select barcode from goods_barcodewhere ConCat(goods_id,color_id,size_id) in
(select ConCat(goods_id,color_id,size_id) from taocan_goods_info where tc_id in (select tc_id from taocan_guige where tc_sku in (select goods_sku from openshop_items where goods_sku like '%tc_00%'))) 展开
(select ConCat(goods_id,color_id,size_id) from taocan_goods_info where tc_id in (select tc_id from taocan_guige where tc_sku in (select goods_sku from openshop_items where goods_sku like '%tc_00%'))) 展开
1个回答
2015-01-19
展开全部
select distinct a.barcode
from goods_barcode a,taocan_goods_info b,taocan_guige c,openshop_items d
where d.goods_sku like '%tc_00%' and
a.goods_id=b.goods_id and nvl(a.color_id,0)=nvl(b.color_id,0) and nvl(a.size_id,0)=nvl(b.size_id,0) and
b.tc_id=c.tc_id and
c.tc_sku=d.goods_sku
from goods_barcode a,taocan_goods_info b,taocan_guige c,openshop_items d
where d.goods_sku like '%tc_00%' and
a.goods_id=b.goods_id and nvl(a.color_id,0)=nvl(b.color_id,0) and nvl(a.size_id,0)=nvl(b.size_id,0) and
b.tc_id=c.tc_id and
c.tc_sku=d.goods_sku
追问
不好意思,这个是mysql数据库,好像不支持nvl %>_<%
追答
ifnull
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询