可能重复:
与加入 MS Access 数据库相关的问题
我在 MS-Access 数据库文件中有一个数据库文件..
我有以下查询:
Select RGN.rgn_regionId,RGN.rgn_titleGuj AS Center,
(Select COUNT(*) from (select Distinct PRS.prs_personId From tb_personDepartment PD,tb_person PRS Where PD.pd_designationId = 1 And PD.pd_personId = PRS.prs_personId And PRS.prs_centerId = RGN.rgn_regionId And PRS.prs_attandanceStatus = 'Y')) As SKAt
From tb_person PRS,tb_personDepartment PD,tb_region RGN
Where PD.pd_personId = PRS.prs_personId
And PRS.prs_centerId = RGN.rgn_regionId
Group By RGN.rgn_regionId,RGN.rgn_titleGuj
表结构如下
select * from tb_person where prs_personId in (3)
--prs_personId prs_uniqId prs_centerId prs_fName prs_mName prs_lName prs_age prs_addres prs_areaId
-- 3 1 1 abc abc abc 12 andn 2
--(1 row(s) affected)
select * from tb_personDepartment where pd_personId in (3)
--pd_personId pd_mahotsavId pd_departmentId pd_designationId pd_MainSK
---------------------- ------------- --------------- ---------------- -----------
--3 1 41 1 1
--3 1 44 2 0
--3 1 104 1 1
--(3 row(s) affected)
select * from tb_personMahotsavDetail where pm_personId in (3)
--pm_personId pm_mahotsavId pm_personStatus pm_sevaDaysH pm_accommodationRequired pm_utaraPlace
--------------- ------------- --------------- -------------- ------------------------ -------------
--3 1 SS 8 0 NULL
--(1 row(s) affected)
select * from tb_person where prs_personId in (3)
-- Single Record
select * from tb_personDepartment where pd_personId in (3)
-- Multiple Record With Same Person Id
select * from tb_personMahotsavDetail where pm_personId in (3)
-- Single Record