473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

NOT EXISTS very slow

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
1 2203
Scott Price
1,384 Expert 1GB
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

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

Similar topics

6
by: Karen Middleton | last post by:
In MS Access I can do in one SQL statement a update if exists else a insert. Assuming my source staging table is called - SOURCE and my target table is called - DEST and both of them have the...
0
by: Linn K B | last post by:
I have a querry that works, but it is incredeble slow, so do anyone have any suggestions how to make this better: The table looks like this Gab(ID (key), Gid, Pid, Status, .....), mening there...
1
by: Onur Bozkurt | last post by:
Is there anyway to check if an e-mail address exists..... I mean someone entered a mail address in a form... I wan't to check if that e-mail reallly exists, doesn't matter if he/she really owns it....
1
by: GG | last post by:
I see ProjectName.pdb for console applications and ProjectName.vshost.exe for windows application after compiling a release with C# 2.0. Is this normal? Why is the debug file needed in a...
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
3
by: niama | last post by:
Hi, This could be a simple thing which I can't decide on. I am working a Document Management System where I need to store the files in a File Server. I was given only one choice that I can only...
2
by: Phil | last post by:
I'm trying to use a custom profile provider and I'm receiving this error message after I deploy a published version of the app. The app works fine when it is run in source code mode. It works...
3
by: KWienhold | last post by:
I have been working with serialization in some places for a while and have now begun to run into version issues. Unfortunately my company is still working with .Net 1.1, so using the VTS of 2.0...
8
by: Sweetiecakes | last post by:
In our series of "probably something simple"... I am doing a File.Exists operation to check if a file exists. Let's assume that this file is C:/test.txt. Now, if I do...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.