Results 1 to 2 of 2
  1. #1
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283

    Subquery Help

    Hello,



    I have a query to show the maximum transaction dates in my TEST table. Here is the syntax:
    Query1 = "SELECT TEST.MEMBER, Max(TEST.TransactionDate) AS MaxTrans FROM TEST GROUP BY TEST.HICN;"

    And then I want to have a subquery to show all the other records that are not in Query1, because I want to delete them from the table.

    I tried using this syntax for a delete query:
    "DELETE TEST.TransactionDate, *
    FROM TEST
    WHERE TEST.TransactionDate Not In (SELECT DMax("MaxTrans","Query1","MEMBER='" & [MEMBER] & "'") AS MaxOfTrans
    FROM TEST);"

    This works but takes forever to run. I need to have something that runs more efficiently. If you guys can help I would appreciate it.

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Subquery
    By Daryl2106 in forum Access
    Replies: 20
    Last Post: 01-13-2013, 07:21 AM
  2. Subquery
    By tomclavil in forum Queries
    Replies: 3
    Last Post: 02-27-2012, 03:05 AM
  3. TOP subquery
    By helpaccess in forum Queries
    Replies: 5
    Last Post: 08-30-2011, 10:28 AM
  4. Subquery sum?
    By anemoskkk in forum Access
    Replies: 0
    Last Post: 04-29-2011, 12:36 PM
  5. Subquery
    By combine21 in forum Queries
    Replies: 2
    Last Post: 09-17-2010, 04:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums