MySQL if else的格式_mysql if...else 的使用

select

case when tca.id = '3' then 'vw' else epc_code end as epccode,tfp.product_id, tfp.vender, tfp.spec_id, tfp.product_classify, tfp.supplier_id, tfp.classify, tfp.category, tfp.texture,

tfp.stand_name, tfp.another_name, tfp.spec_name, tfp.spec_m, tfp.oem, tfp.factorynum, tfp.pics, tfp.unit, tfp.pac_spec,

tfp.ourc_price, tfp.price, tfp.exp_date, tfp.capacity, tfp.stock_max, tfp.explains, tfp.goods_max, tfp.business_type,

tfp.is_special, tfp.is_audit, tfp.is_show_company, tfp.is_show_brand, tfp.is_show_business, tfp.special_begin_time,

tfp.special_end_time, tfp.market_enable, tfp.buy_count, tfp.remark, tfp.status, tfp.order_min, tfp.create_time,

tfp.update_time, tfp.retail_price,tfp.master_graph,tar.local_name AS cityName ,

tea.local_name AS provinceName,taq.quality_name AS qualityName,

tpt.name AS classifyName,taso.special_price AS specialPrice

from

t_full_product_ford tfp

left join t_company tm ON tm.com_id = tfp.supplier_id

LEFT JOIN t_area tea ON tm.province_id = tea.id

LEFT JOIN t_area tar on tar.id = tm.city_id

left join t_data_quality taq ON taq.quality_id = tfp.spec_id

left JOIN t_product_type tpt ON tpt.s_id = tfp.category

LEFT JOIN t_admin_special_offer taso on taso.product_id=tfp.product_id

LEFT JOIN t_car_vender tca on tca.id=tfp.vender and epc_code=taso.table_name

and taso.is_effective = 0

and taso.end_time_special > now()

and now() > taso.start_time_special_off

where tfp.product_id = 1 and tfp.market_enable = 1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值