sql多表分类查询
来源:互联网 发布:淘宝商品资质图片 编辑:程序博客网 时间:2024/06/10 02:47
一般的多表查新用到的就是inner join ,left join,right join之类,根据相同的字段值进行比较然后拼接起来
inner join 是内连接,就是只列出满足条件的数据
left join 是左外连接查询,就是查询出所有左表的数据,然后符合查询条件的列出,不符合查询条件的在后面列为空
right join类似左外连接,不在阐述
需要注意的是你group by了什么,你在select中就要有相应的查询
select sum(USER_AMOUNT) as sum,stat_time ,c.project_name as projectName ,d.customer_name as customerNamefrom reg_user_stat a inner join product b on a.product_id=b.product_id inner join project c on a.project_id=c.project_id inner join customer d on c.customer_id=d.customer_id inner join business e on d.business_id=e.business_id inner join pic f on e.pic_id=f.pic_id inner join team g on f.team_id =g.team_id inner join area h on g.area_id=h.area_id inner join agent i on h.agent_id=i.agent_id where 1=1 group by stat_time ,c.project_name ,d.customer_name order by stat_time ASC
0 0
- sql多表分类查询
- sql分类显示查询
- sql 子分类查询
- SQL distinct 分类查询
- SQL查询详细分类
- SQL分类查询的记录
- SQL子查询简单分类
- sql server分类查询归总
- sql查询语句_多字段分类汇总_多表合并
- mysql 多表分类查询 好大上啊!
- 多分类产品查询
- 表连接查询分类
- 表连接查询分类
- 一个查询分类的SQL题
- SQL 查询某属性分类数据和
- 无限级分类查询子类SQL
- SQL优化--查询优化技术分类
- SQL-查询的分类及使用
- Android API Guides---Canvas and Drawables
- 【翻译】GCJ 2008 APAC local onsites C Millionaire 题解
- 树的最大路径和
- javascrip基本知识总结
- cocos2dx 3.x 图层点击鼠标事件的屏蔽
- sql多表分类查询
- 《精通CSS:高级Web标准解决方案》学习过程--III
- set、list、map
- canvas -方形抽奖
- Google官方MVP示例之TODO-MVP
- iOS开发-NSAttributedString富文本
- ubuntu 搭建LAMP环境并配置
- J2SE(七)Java之类的实例化
- Android 编程下 SQLite 大数据量操作优化