mysql连表查询
SELECT
fo.uid,fo.ordersn,fo.price,fog.number,fog.goods_json,fog.price,fo.agent_id,fo.clerk_id
FROM
`fm_order` as fo left join fm_order_goods as fog
on
fo.id=fog.order_id
select
uuu.is_admin,uuu.phone,csdd.name,fo.coupon_price,fo.express_price,
fo.pay_number,fgo.title,fg.title,fgo.marketprice,fgo.productprice,fgo.costprice,fgo.goodssn,
fb.name,fo.ordersn,fo.created_at,fo.updated_at,fo.pay_state,fo.state,fo.pay_type,fo.price,fod.number,fors.ordersn,fors.created_at as forscreated_at,fors.state as forsstate
from
fm_order as fo left join fm_order_goods as fod on fo.id=fod.order_id
left join fm_goods as fg on fod.goods_id=fg.id
left join fm_brand as fb on fg.brand=fb.id
left join fm_goods_option as fgo on fgo.id=fod.option_id
left join fm_user_coupon as csd on fo.coupon_id = csd.id
left join fm_coupon as csdd on csd.coupon_id = csdd.id
left join fm_user as uuu on fo.uid = uuu.id
left join fm_order_rights as fors on fo.id=fors.order_id
where fo.pay_state=2 and fo.is_refund=1

登录后可发表评论
点击登录