select
distinct *, (select price1 from mini_goods_opt where goodsno=b.goodsno and price1 > 0 limit 1) price, (select primeprice from mini_goods_opt where goodsno=b.goodsno and type=0 and idx=0 order by no limit 1) primeprice
from
mini_goods_link a
left join mini_goods b on a.goodsno=b.goodsno
where
INSTR(a.catno,'100004013')
and state > -1
and b.goodsno <> '28433'
order by rand()
limit 4