Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 95267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:37:53+00:00 2026-05-10T23:37:53+00:00

I use an SQL statement to remove records that exist on another database but

  • 0

I use an SQL statement to remove records that exist on another database but this takes a very long time.

Is there any other alternative to the code below that can be faster? Database is Access.

email_DB.mdb is from where I want to remove the email addresses that exist on the other database (table Newsletter_Subscribers) customers.mdb is the other database (table Customers)

SQLRemoveDupes = 'DELETE FROM Newsletter_Subscribers WHERE EXISTS (select * from [' & strDBPath & 'Customers].Customers ' _       & 'where Subscriber_Email = Email or Subscriber_Email = EmailO)'  NewsletterConn = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=' & strDBPath & 'email_DB.mdb'  Set MM_editCmd = Server.CreateObject('ADODB.Command') MM_editCmd.ActiveConnection = NewsletterConn MM_editCmd.CommandText = SQLRemoveDupes MM_editCmd.Execute MM_editCmd.ActiveConnection.Close Set MM_editCmd = Nothing 

EDIT: Tried the SQL below from one of the answers but I keep getting an error when running it:

SQL: DELETE FROM Newsletter_Subscribers WHERE CustID IN (select CustID from [‘ & strDBPath & ‘Customers].Customers where Subscriber_Email = Email or Subscriber_Email = EmailO)

I get a ‘Too few parameters. Expected 1.’ error message on the Execute line.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:37:54+00:00Added an answer on May 10, 2026 at 11:37 pm

    I would use WHERE Subscriber_Email IN (Email, Email0) as the WHERE clause

    SQLRemoveDupes = 'DELETE FROM Newsletter_Subscribers WHERE EXISTS ' & _  (select * from [' & strDBPath & 'Customers].Customers where Subscriber_Email IN (Email, EmailO)' 

    I have found from experience that using an OR predicate in a WHERE clause can be detrimental in terms of performance because SQL will have to evaluate each clause separately, and it might decide to ignore indexes and use a table scan. Sometime it can be better to split it into two separate statements. (I have to admit I am thinking in terms of SQL Server here, but the same may apply to Access)

    'DELETE FROM Newsletter_Subscribers WHERE EXISTS ' & _      (select * from [' & strDBPath & 'Customers].Customers where Subscriber_Email = Email)'  'DELETE FROM Newsletter_Subscribers WHERE EXISTS ' & _      (select * from [' & strDBPath & 'Customers].Customers where Subscriber_Email = EmailO)' 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Looks like this: String actualResult = MessageFormat.format('{0,number,#.##%}', fraction); ... is… May 11, 2026 at 2:10 pm
  • added an answer Isn't that just a FindName call in you code behind… May 11, 2026 at 2:10 pm
  • added an answer You just need to pick out the property you want… May 11, 2026 at 2:10 pm

Related Questions

I use an sql server regularly and have recently been getting frustrated by the
I would like to use an SQL Server table as an action queue. So
I am trying to paginate the results of an SQL query for use on
I once worked with an architect who banned the use of SQL views. His
This is a bit of a weird one, and I could well be coding
I've googled around and searched the MYSQL docs ad nauseam and couldn't find a
I need to alter a trigger in sql server 2005 and I want to
I've got a (SQL Server 2005) database where I'd like to create views on-the-fly.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.