+ Reply to Thread
Results 1 to 4 of 4

Find records that match criteria of multiple fields

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    46

    Find records that match criteria of multiple fields

    using sql or access query I would like to create an expression that aggregates the first field and I would like to see all records grouped by the relationship with another field. Let me show an example.

    My query shows:

    field1 field2
    apple a
    apple b
    banana a
    carrot a
    carrot b
    dog b
    elephant b

    I would like my query to now display a third field and group field :

    field1 field3
    apple both
    banana a
    carrot both
    dog b
    elephant b


    please point me in the right direction!

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Find records that match criteria of multiple fields

    See attached. Need three queries to make this work for me.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    11-07-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Find records that match criteria of multiple fields

    ^ alansidman. i was able to figure this out.

    yes I needed 3 queries. I first generated queries with unique records for field2 criteria: "a" and another for "b", then joined them on an intersect distinct in the third query.

    Appreciate your response.

    edit: this was helpful
    http://www.gplivna.eu/papers/sql_set_operators.htm

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Find records that match criteria of multiple fields

    Would be interested in seeing your SQL statements that you used to solve your issue since I believe they are different from what I proposed. Would you please post them? Always interested in learning new ways to do things.

    Thanks,
    Alan

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1