C
Clinton M James
I am having a problem with a query i have written and was wondering if
anybody can help tell me why.
If I do not put the end where statment (Where tiered.posi....) it works fine
but when i include a where clause the column for "claimnumber" displays
#error all down it and then i get excel tell me there is no current record.
I can't see anything wrong with the query so would appreciate anybody
telling what may be the cause.
The query is as follows:
SELECT tiered.assessorcode, tiered.claimnumber, tiered.posit, tiered.tier
FROM [select
claim.assessorcode,
claim.claimnumber,
(SELECT x.tier FROM `E:\NQA\NQA\NQA_Operational.MDB`.stafftiers X where
x.unumber = (SELECT TOP 1 U.uNumber from
`E:\NQA\NQA\NQA_Operational.MDB`.historicalInfo U where u.assessorcode =
claim.assessorcode and u.dateFROM <= (SELECT R.dateExtracted from
auditscrapeIndex r where r.runnum = 1) order by u.datefrom desc)) as tier,
(select COUNT(claim2.claimnumber)
from auditscrapes claim2
where
claim2.claimnumber <= claim.claimnumber
and claim2.runnum = 1
and claim2.assessorcode = claim.assessorcode) as posit
from
auditscrapes claim
where runnum = 1
group by claim.assessorcode, claim.claimnumber
]. AS tiered
WHERE tiered.posit <=
iif((SELECT tt.tiertype from `E:\NQA\NQA\NQA_Operational.MDB`.tierInfo tt
where tt.tier = tiered.tier) = 'N',(SELECT tt.tierNumber from
`E:\NQA\NQA\NQA_Operational.MDB`.tierInfo tt where tt.tier = tiered.tier),
(SELECT COUNT(*) from auditscrapes cl where cl.assessorcode =
tiered.assessorcode and cl.runnum = 1) *((SELECT tt.tierNumber from
`E:\NQA\NQA\NQA_Operational.MDB`.tierInfo tt where tt.tier =
tiered.tier)/100.00) );
Thank you in advance for your assistance.
Cheers,
Clint
anybody can help tell me why.
If I do not put the end where statment (Where tiered.posi....) it works fine
but when i include a where clause the column for "claimnumber" displays
#error all down it and then i get excel tell me there is no current record.
I can't see anything wrong with the query so would appreciate anybody
telling what may be the cause.
The query is as follows:
SELECT tiered.assessorcode, tiered.claimnumber, tiered.posit, tiered.tier
FROM [select
claim.assessorcode,
claim.claimnumber,
(SELECT x.tier FROM `E:\NQA\NQA\NQA_Operational.MDB`.stafftiers X where
x.unumber = (SELECT TOP 1 U.uNumber from
`E:\NQA\NQA\NQA_Operational.MDB`.historicalInfo U where u.assessorcode =
claim.assessorcode and u.dateFROM <= (SELECT R.dateExtracted from
auditscrapeIndex r where r.runnum = 1) order by u.datefrom desc)) as tier,
(select COUNT(claim2.claimnumber)
from auditscrapes claim2
where
claim2.claimnumber <= claim.claimnumber
and claim2.runnum = 1
and claim2.assessorcode = claim.assessorcode) as posit
from
auditscrapes claim
where runnum = 1
group by claim.assessorcode, claim.claimnumber
]. AS tiered
WHERE tiered.posit <=
iif((SELECT tt.tiertype from `E:\NQA\NQA\NQA_Operational.MDB`.tierInfo tt
where tt.tier = tiered.tier) = 'N',(SELECT tt.tierNumber from
`E:\NQA\NQA\NQA_Operational.MDB`.tierInfo tt where tt.tier = tiered.tier),
(SELECT COUNT(*) from auditscrapes cl where cl.assessorcode =
tiered.assessorcode and cl.runnum = 1) *((SELECT tt.tierNumber from
`E:\NQA\NQA\NQA_Operational.MDB`.tierInfo tt where tt.tier =
tiered.tier)/100.00) );
Thank you in advance for your assistance.
Cheers,
Clint