and also may be you have to join ud.strUID with the respective field in tblUnitPOsition. in that case try like this
Select ud.strUIc,
Sum(up.intReqstr) as REQ,
Sum(up.intAsgnStr) as ASGN,
CAST(CEILING(Sum(up.intAsg
(Select(sum(intReqStr)) from
tblUnitDeployData as ud1 INNER JOIN
tblUnitPosition up1 on up1.intUnitMobId = ud1.intUnitMobId
where Substring(strpara, 1, 1) = 9 and ud.strUIc = ud1.strUIc ) as [O/S],
(Select(sum(intAsgnStr)) from
tblUnitDeployData as ud1 INNER JOIN
tblUnitPosition up1 on up1.intUnitMobId = ud1.intUnitMobId
where Substring(strpara, 1, 1) = 9 and ud.strUIc = ud1.strUIc ) as [O/S ASGN],
from tblUnitDeployData as ud INNER JOIN
tblUnitPosition as up on up.intUnitMobId = ud.intUnitMobId
where Substring(up.strpara, 1, 1) not in ('9')
Group by up.intUnitMobId, strUIc
Main Topics
Browse All Topics





by: appariPosted on 2009-11-03 at 18:16:07ID: 25735830
try this
nStr)*1.0 / Sum(up.intReqstr) * 100) as varchar) + '%' as [% ASGN], Id ) as [O/S], Id ) as [O/S ASGN],
Select ud.strUIc,
Sum(up.intReqstr) as REQ,
Sum(up.intAsgnStr) as ASGN,
CAST(CEILING(Sum(up.intAsg
(Select(sum(intReqStr)) from tblUnitPosition where Substring(strpara, 1, 1) = 9 and up.intUnitMobId = tblUnitPosition.intUnitMob
(Select(sum(intAsgnStr)) from tblUnitPosition where Substring(strpara, 1, 1) = 9 and up.intUnitMobId = tblUnitPosition.intUnitMob
from tblUnitDeployData as ud INNER JOIN
tblUnitPosition as up on up.intUnitMobId = ud.intUnitMobId
where Substring(up.strpara, 1, 1) not in ('9')
Group by up.intUnitMobId, strUIc