5 Star 50 Fork 0

Gitee Community / 码力传递:晒代码赢奖品

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
一段多表联查的的SQL,包含计数,包含分组,包含排序,包含统计 693 Bytes
一键复制 编辑 原始数据 按行查看 历史
//
一句sql包含相关信息的所有查询,字段计数,多表联查,条件,分组,排序,分页
SELECT
sum(c.fz+c.pf+c.gf+c.yf) as zf,
sum(c.fz) as fz,sum(c.pf) as pf,
sum(c.gf) as gf,sum(c.yf) as yf,
sum(c.zwh) as zwh,
a.jz,
a.pwlll,
a.dz,
a.lll,
a.mtype,
a.id,
a.userid,
a.type,
a.title,
a.member,
b.name,
b.phone,
b.mail,
b.sf,
b.city,
b.school,
FROM `production` `a`
LEFT JOIN `user` `b`
ON `a`.`userid`=`b`.`userid`
LEFT JOIN `pf` `c`
ON `a`.`id`=`c`.`conid`
WHERE `a`.`status` = 2 AND `a`.`jz` IN ('0','1','2','3','4')
GROUP BY `a`.`id`
ORDER BY `zf` DESC,`a`.`tp` ASC,`a`.`dz` DESC,`a`.`lll` DESC,`a`.`id` DESC
LIMIT 0,120
1
https://gitee.com/gitee-community/gitee-7th-event-3.git
git@gitee.com:gitee-community/gitee-7th-event-3.git
gitee-community
gitee-7th-event-3
码力传递:晒代码赢奖品
master

搜索帮助