码迷,mamicode.com
首页 > 数据库 > 详细

mysql语句写法(左连与子查询结合)实战

时间:2017-09-25 11:56:06      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:msyql

select 

c.card_number,

c.card_name,

t.type_name,

c.card_discount,

t.type_low,

c.card_integral,

(c.card_recharge_balance+c.card_give_balance) as num,

v.people,

c.card_time 

from 

`vip_card` as c 

left join 

(

select 

count(vipid) as people,

card_number 

from vip 

group by card_number

) as v

on 

c.card_number=v.card_number 

left join 

`vip_type` as t 

on

c.type_id=t.type_id 

where 

c.store_key=‘556655‘;


mysql语句写法(左连与子查询结合)实战

标签:msyql

原文地址:http://12173069.blog.51cto.com/12163069/1968333

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!