mysql 多表联查条件赋值问题?

博客提到分开给条件可保证左表字段全部显示,且右表不影响左表,涉及数据库表操作相关信息技术内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<select id="selectDetailByQueryPriceId" resultType="com.shop.core.beans.responseBeans.officePrice.QueryPriceResponse"  >
    select cqpe.id as id ,
           cqpe.query_price_id as queryPriceId,
           cqpe.offer_price_detail_id as offerPriceDetailId,
           cqpe.goods_common_id as goodsCommonId,
           cqpe.goods_common_name as goodsCommonName,
           cqpe.goods_sku_id as goodsSkuId,
           cqpe.goods_sku_name as goodsSkuName,
           cqpe.goods_image as goodsImage,
           cqpe.number as number,
           cqpe.goods_unit as goodsUnit,
           cqpe.remark as remark,
           cope.goods_price as goodsPrice
    from club_query_price_detail cqpe left join ( SELECT * FROM club_offer_price_detail WHERE offer_price_user= #{shopId,jdbcType=VARCHAR} ) cope on  cqpe.id =cope.query_detail_price_id
    where cqpe.query_price_id = #{queryPriceId,jdbcType=VARCHAR}
  </select>

在这里插入图片描述
分开给条件,这样就能保证左表字段全部出来。右表不影响左表。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值