首页 > 代码库 > sql练习记录

sql练习记录

三表关联如果字段为0则表示是散客卡

select a.shop_id as id,b.shop_name,a.balance,a.point,
(IF(a.card_type_id<>0,concat(c.card_type,"(测试环境测试11)"),‘散客卡(测试环境测试11)‘)) as card from members a INNER JOIN
shops b on a.shop_id=b.id LEFT JOIN card_types c on a.card_type_id=c.id where a.mobile_phone=11111111111;

sql练习记录