在Access中,多表查询并去掉重复行,怎么得到记录数呢?用Count(DISTINCT 表名.列名)出错呢?
//这是查询记录集,是对的
select DISTINCT TA.ID,TA.Dog, TA.LastRegTime,TA.DogType,TA.UserName
from TA,TB,RegInfo where TA.VendorID=1 and TA.DogGroupID=7 and ( (TA.ID=TB.DogID and TB.ID=RegInfo.ApplyID ) or (TA.LastRegTime is null) ) order by TA.ID desc
//可想直接查上面查询的记录行数,就出错呢?
select Count(DISTINCT TA.ID)
from TA,TB,RegInfo where TA.VendorID=1 and TA.DogGroupID=7 and ( (TA.ID=TB.DogID and TB.ID=RegInfo.ApplyID ) or (TA.LastRegTime is null) )
谢谢指点一二了~ 现在的笨方法是想查询记录集,再得到它的记录数,汗~~