求统计的SQL语句(必结贴) select table1.企业代码,count(isnull(职工代码,0))as 人数 from table1 left join table2 on table1.企业代码=table2.企业代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a.企业代码,a.企业名,企业人数=count(b.职工代码)from 表一 a left join 表二 b on a.企业代码=b.企业代码group by a.企业代码,a.企业名 select a.企业代码,a.企业名,企业人数=count(b.职工代码)from 表一 a left join 表二 b on a.企业代码=b.企业代码group by a.企业代码,a.企业名 select a.企业代码, isnull(count(*),0) as 人数from 表一 a left join 表二 b on a.企业代码=b.企业代码group by a.企业代码 select a.企业代码,a.企业名,isnull(b.人数列表,0) as 人数列表from 表一 a left join (select 企业代码,count(*) as 人数列表 from 表二 group by 企业代码) bon a.企业代码=b.企业代码 晕,忘了group byselect table1.企业代码,count(isnull(职工代码,0))as 人数 from table1 left join table2 on table1.企业代码=table2.企业代码 group by table1.企业代码 分布式数据库库数据同步问题 sql 替换空的查询语句 时间间隔查询 求一SQL语句 这是怎么回事? 数据库出现如下错误,求救! 关于一个多表查询的问题杂合 看不见是什么啊???还有就是想问下 前面SQL都是处理速度方面很正常的~~但是有时就边的很慢 这个是什么原因? 求人急救!程序不能运行 MFC下ACCESS数据的读取问题 急用,用update 关于软件的路径问题!
from 表一 a left join 表二 b on a.企业代码=b.企业代码
group by a.企业代码,a.企业名
from 表一 a left join 表二 b on a.企业代码=b.企业代码
group by a.企业代码,a.企业名
from 表一 a left join 表二 b on a.企业代码=b.企业代码
group by a.企业代码
from 表一 a left join
(select 企业代码,count(*) as 人数列表 from 表二 group by 企业代码) b
on a.企业代码=b.企业代码
select table1.企业代码,count(isnull(职工代码,0))as 人数 from table1 left join table2 on table1.企业代码=table2.企业代码 group by table1.企业代码