Hi, I have a query with three fields - Qty, CCID, and UseLast(calculated).
If possible, I would like the calculated field (UseLast) to use the last CCID where qty is not 0 and use the matching CCID where there is a quantity:
Qty CCID UseLast
11 1 1
22 2 2
34 3 3
0 4 3
0 5 3
26 6 6
0 7 6
23 8 8
SELECT tblProb.Qty, tblProb.CCAlias, IIf([qty]=0,"Need Help - use previous CcId no",[CcId]) AS UseLast
FROM mtActRate AS tblProb
GROUP BY tblProb.Qty, tblProb.CcId, IIf([qty]=0,"Need Help - use previous CcIdno",[CcId])
ORDER BY tblProb.CcId;
Any help would be appreciated. Thanks
If possible, I would like the calculated field (UseLast) to use the last CCID where qty is not 0 and use the matching CCID where there is a quantity:
Qty CCID UseLast
11 1 1
22 2 2
34 3 3
0 4 3
0 5 3
26 6 6
0 7 6
23 8 8
SELECT tblProb.Qty, tblProb.CCAlias, IIf([qty]=0,"Need Help - use previous CcId no",[CcId]) AS UseLast
FROM mtActRate AS tblProb
GROUP BY tblProb.Qty, tblProb.CcId, IIf([qty]=0,"Need Help - use previous CcIdno",[CcId])
ORDER BY tblProb.CcId;
Any help would be appreciated. Thanks