Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    LadyDee is offline Novice
    Windows 10 Access 2019
    Join Date
    Mar 2024
    Posts
    8
    Hello Isladogs,



    Thanks for the explanation. I'll try the SQL given in #1 and see if that changes anything.

  2. #17
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    UNION might be appropriate for search operation. I've never tried a UNION with more than a dozen fields. Use of * in UNION only works if tables have same number of fields and they are all in same order in table design. Again, we know next to nothing of your schema.

    However, with your volume of records, UNION performance will likely not be satisfactory anyway.

    Colin's Option 1 is a Cartesian structure - expect it to fail with tables of 800K records.
    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. #18
    LadyDee is offline Novice
    Windows 10 Access 2019
    Join Date
    Mar 2024
    Posts
    8
    errorMsg: Too many fields defined - the notation of adding ".*" per table did not change anything, Let me digest what is posted here and see what can be done.

    Best Wishes everyone! - I'll be back with either more questions or the discovered resolution

  4. #19
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I suggest the only real solution is writing these 3 tables to a normalized table - which is basically what a UNION query would emulate.

    With UNION, you would need to include a calculated field to provide a category value to identify the source set. First SELECT defines field names and data types and 50 SELECT lines are allowed. Example:

    SELECT "A" AS Cat, Field1, Field2 FROM TableA
    UNION SELECT "B", Field1, Field2 FROM TableB
    UNION SELECT "C", Field1, Field2 FROM TableC;

    Suggest you test performance with a limited selection of fields.
    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.

  5. #20
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Quote Originally Posted by LadyDee View Post
    errorMsg: Too many fields defined - the notation of adding ".*" per table did not change anything, Let me digest what is posted here and see what can be done.

    Best Wishes everyone! - I'll be back with either more questions or the discovered resolution
    I didn't suggest that #1 was in any way a good solution.
    I also didn't suggest that rewriting it would be more likely to succeed. My comment was that the SQL would be clearer

    Cartesian queries are only rarely a good solution.
    Union queries can work with many fields if properly constructed but needing to use them is often a workaround for poor database design

    The best solution of your 4 queries would be a properly constructed JOIN.

    However, the reality is that you need to first learn how to create properly normalised tables, then how to construct queries correctly either using SQL or the query designer
    What you have now isn't going to work as everyone so far has been saying to you.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #21
    madpiet is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    154
    Quote Originally Posted by June7 View Post
    I suggest the only real solution is writing these 3 tables to a normalized table - which is basically what a UNION query would emulate.

    With UNION, you would need to include a calculated field to provide a category value to identify the source set. First SELECT defines field names and data types and 50 SELECT lines are allowed. Example:

    SELECT "A" AS Cat, Field1, Field2 FROM TableA
    UNION SELECT "B", Field1, Field2 FROM TableB
    UNION SELECT "C", Field1, Field2 FROM TableC;

    Suggest you test performance with a limited selection of fields.
    If you know there won't be any duplicate records, you should use UNION ALL instead. UNION removes duplicates (and I think sorts), and that's computationally expensive. Don't do it unless you really have to.

  7. #22
    LadyDee is offline Novice
    Windows 10 Access 2019
    Join Date
    Mar 2024
    Posts
    8
    Thank you for all the feedback.
    My ultimate solution was to import the three access tables into Sql Server and UNION ALL them onto one new table - - so simple and I was happy to see the Successful message when it was done.
    Dropped the Access PK Column and then created a new PK in SSMS. I didn't link it to the Access frontend as yet though.

  8. #23
    madpiet is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    154
    You may have to use SQL Server for your tables. They're too wide for Access. SQL Server can handle (I think) 1024 columns per table. The free version can handle (I think) 10GB of data.

    I think Rebecca Riordan wrote an article like 20 years ago about doing joins like you're describing. I'm pretty sure you need to have one "master" table and a bunch of 1:1 children. (I know, sounds odd, because a parent:child relationship is almost always one to many.) The "parent" or master table would have an incrementing primary key, and others would be unique and non-autonumber, because the relationship would determine the value stored. Then I think it would work.

    If you were to do the same in SQL Server, you could just declare referential integrity within the table definition with foreign key constraints. (So you'd create the "parent" table first, then GO and then create the 1:1 children). The nice thing about SQL Server is that you can use CROSS APPLY to sort of unpivot repeating groups.

    Not sure how to do the same in Access, though.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 02-25-2018, 06:50 PM
  2. Replies: 3
    Last Post: 07-24-2015, 06:39 AM
  3. Search Multiple Tables (Identical Fields)
    By tristangemus in forum Queries
    Replies: 1
    Last Post: 06-21-2013, 10:32 AM
  4. Replies: 3
    Last Post: 06-19-2013, 06:34 PM
  5. Replies: 3
    Last Post: 12-10-2009, 02:16 PM

Tags for this Thread

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