select *,
(select ebay_itemurl from ebay_orderdetail where sku=a.goods_sn LIMIT 1) as pic ,
(select goods_cost from ebay_iostore as c join ebay_iostoredetail as b on c.io_ordersn= b.io_ordersn
where (c.type ='0' or c.type='2' or c.type ='99' or c.type ='98' or c.type ='97' or c.type ='96' or c.type ='93')
and b.goods_sn =a.goods_sn order by c.id desc limit 1
) as purchase_price
from ebay_goods a
where a.goods_status=0
(select goods_cost from ebay_iostore as c
join ebay_iostoredetail as b on c.io_ordersn= b.io_ordersn
where (c.type ='0' or c.type='2' or c.type ='99' or c.type ='98' or c.type ='97' or c.type ='96' or c.type ='93')
and b.goods_sn =a.goods_sn
order by c.id desc
limit 1
) as purchase_price 这段现在是查一个字段,我现在需要显示2个字段的内容,请问应该怎么写啊,我又不想再写一个这样的,感觉效率太低
所以你表结构固定的话,没什么优化的空间。可以使用explain命令看看哪些索引命中。