日期:2014-05-17  浏览次数:20457 次

求sql语句????
项目表 proinfo 字段如下,proid为guid类型,主键,proname为项目名称.
proid proname  

项目计划表 proPlan 字段如下,ppid,proid为guid类型,ppid为主键,proid为外键.指向proinfo表中的proid.
ppid proid 

求proid,countPro(proid在表proPlan字段proid中出现的次数)?

------解决方案--------------------
select proid,count(1)
from proPlan
group by proid
------解决方案--------------------
对你的要求还是不是很明白
SQL code
select b.proid,count(1) countPro
from proinfo a inner join proPlan  b on a.proid=b.proid
group by b.proid

------解决方案--------------------
晕,看你代码和你的描述出入很大哦
------解决方案--------------------
SQL code

select a.proid,count(b.proid) as countPro
from proinfo a inner join proPlan b on a.proid=b.proid

------解决方案--------------------
探讨

搞定了,下次自己先想想。。。。

SELECT WF_R_PC.R_PC_ID,ISNULL(WF_R_PB.R_PC_IDCOUNT,0)
FROM WF_Research_ProjectCharter AS WF_R_PC
LEFT JOIN (SELECT R_PC_ID,COUNT(R_PC_ID) AS R_PC_IDCOUNT FROM WF_Research_Proje……

------解决方案--------------------
探讨

搞定了,下次自己先想想。。。。

SELECT WF_R_PC.R_PC_ID,ISNULL(WF_R_PB.R_PC_IDCOUNT,0)
FROM WF_Research_ProjectCharter AS WF_R_PC
LEFT JOIN (SELECT R_PC_ID,COUNT(R_PC_ID) AS R_PC_IDCOUNT FROM WF_Research_Proje……

------解决方案--------------------
探讨

搞定了,下次自己先想想。。。。

SELECT WF_R_PC.R_PC_ID,ISNULL(WF_R_PB.R_PC_IDCOUNT,0)
FROM WF_Research_ProjectCharter AS WF_R_PC
LEFT JOIN (SELECT R_PC_ID,COUNT(R_PC_ID) AS R_PC_IDCOUNT FROM WF_Research_Proje……

------解决方案--------------------
探讨
搞定了,下次自己先想想。。。。

SELECT WF_R_PC.R_PC_ID,ISNULL(WF_R_PB.R_PC_IDCOUNT,0)
FROM WF_Research_ProjectCharter AS WF_R_PC
LEFT JOIN (SELECT R_PC_ID,COUNT(R_PC_ID) AS R_PC_IDCOUNT FROM WF_Research_Projec……