Results 1 to 4 of 4
  1. #1
    Petox is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Location
    Lancaster
    Posts
    2

    Question Query compared to another table


    Hello!

    I'm having a lot of trouble trying to figure this out, because I'm so green I don't know the right question to ask.

    Can I pull the records from a table, where values in field C are less than any values in field C of another table?

    Any help is appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Do these tables have a relationship? Show examples of raw data and desired output.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Petox is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Location
    Lancaster
    Posts
    2
    I do not believe the tables have a relationship, other than that the field names are the same.


    Table 1
    Field1 Field2
    1 Bob 25
    2 Heidi 30
    3 Frank 88
    4 Frodo 49
    5 Batman 41


    Table 2
    Field1 Field2
    1 Blah 55
    2 Blah 43
    3 Blah 80


    Result
    Field1 Field2
    1 Bob 25
    2 Heidi 30
    5 Batman 41



    For me, this is a question of logic as a precursor to a much more complicated question. If this isn't possible then it rules out trying to solve the much larger issue.

    The larger issue in a nutshell: I have a table of 4.1 million records which I need to filter down to less than 25 miles of any record in another table (about 800 records). I do this in Excel now with a spherical trigonometry formula, but am seeking ways to do this within a database. Exporting a quarter of a million records, and then using SUMPRODUCT to identify if each record is within x miles of the other 800 is extremely time consuming and pretty harsh on my processor.

    If unlinked table comparisons isn't an option, then I guess I just need to deal with long process times and maybe buy a high-end processor. I'm not above locating commercial/freelance services to do this, it's just that I have no idea where to start.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    PMFJI,

    Try this:
    Code:
    SELECT Table1.Field1, Table1.Field2
    FROM Table1
    WHERE (((Table1.Field2)<(SELECT Top 1 Min(Table2.Field2) AS MinOfField2 FROM Table2;)))
    ORDER BY Table1.Field2;

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

Similar Threads

  1. Replies: 3
    Last Post: 09-09-2015, 03:11 PM
  2. Replies: 2
    Last Post: 01-20-2014, 12:50 PM
  3. Replies: 7
    Last Post: 10-04-2012, 01:30 PM
  4. Lookup of result based on 1 value compared to range.
    By Scorpio11 in forum Database Design
    Replies: 4
    Last Post: 04-11-2012, 02:30 PM
  5. Replies: 2
    Last Post: 10-27-2009, 07:09 AM

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