By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,560 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,560 IT Pros & Developers. It's quick & easy.

NOT EXISTS very slow

P: 1
Please guide me how to improve this query

DELETE
FROM AdjGrp_sum AS adj
WHERE nz(Diff_Amt_USD) = 0 AND nz(Opics_Pnl_Sum) = 0 AND nz(Official_Pnl) = 0 AND nz(Mxg_Sum_AdjGrp) = 0
AND NOT EXISTS (
SELECT 1
FROM AdjGrp_sum AS adj2
WHERE adj.COB = adj2.COB
AND adj.Portfolio = adj2.Portfolio
AND adj.CCY = adj2.CCY
AND adj.System = adj2.System
AND (adj2.Diff_Amt_USD <> 0
OR adj2.Opics_Pnl_Sum <> 0
OR adj2.Official_Pnl <> 0
OR adj2.Mxg_Sum_AdjGrp <> 0
)
)
Aug 15 '07 #1
Share this Question
Share on Google+
1 Reply


Scott Price
Expert 100+
P: 1,384
Expand|Select|Wrap|Line Numbers
  1. DELETE
  2. FROM AdjGrp_sum AS adj
  3. WHERE nz(Diff_Amt_USD) = 0 AND nz(Opics_Pnl_Sum) = 0 AND nz(Official_Pnl) = 0 AND nz(Mxg_Sum_AdjGrp) = 0
  4. AND NOT EXISTS (
  5. SELECT 1
  6. FROM AdjGrp_sum AS adj2
  7. WHERE adj.COB = adj2.COB
  8. AND adj.Portfolio = adj2.Portfolio
  9. AND adj.CCY = adj2.CCY
  10. AND adj.System = adj2.System
  11. AND (adj2.Diff_Amt_USD <> 0
  12. OR adj2.Opics_Pnl_Sum <> 0
  13. OR adj2.Official_Pnl <> 0
  14. OR adj2.Mxg_Sum_AdjGrp <> 0))
What version of Access are you working with? Could you explain your problem a little more clearly? I'm not sure exactly what the issue is you are asking about here.

Regards,
Scott
Aug 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.