文章目录
- mysql左连接查询时多条件的注意事项
- 1、返回左表所有数据
- 2、返回符合条件的数据
mysql左连接查询时多条件的注意事项
1、返回左表所有数据
代码语言:javascript复制select *
from oilDaily left outer join wellInfo
on oilDaily.wellId=wellInfo.wellId and oilDaily.wellId='庆11-001'
group by wellId,oilTime
order by wellId asc,oilTime asc;
2、返回符合条件的数据
代码语言:javascript复制select *
from oilDaily left outer join wellInfo
on oilDaily.wellId=wellInfo.wellId
where oilDaily.wellId='庆11-001'
group by wellId,oilTime
order by wellId asc,oilTime asc;