Consulting

Results 1 to 8 of 8

Thread: Sleeper: Joining Tables with a Range and Wildcards values

  1. #1
    VBAX Newbie
    Joined
    Feb 2023
    Posts
    3
    Location

    Sleeper: Joining Tables with a Range and Wildcards values

    Morning gurus

    I'm stumped and need some help with a query join.

    I have a table called "Role_Transactions" (its from SAP) and for each "Role", it has multiple "TCode_From" and "TCode_To" values. Example below;
    Roles.jpg

    I need to match all the "TCodes" from table "Transactions" to the "TCode_From" and "TCode_To" values above, and display both "Role" and "TCode" in the output.
    Transactions.jpg

    Here's where it gets tricky for me;
    - If only "TCode_From" is populated ("TCode_To" is null), then the match is exact between the two tables.
    - If there is a value in "TCode_To", that indicates all "TCodes" within the range should be matched.
    - Sometimes "TCode_From" and "TCode_To" have a * for a wildcard in them too. Indicating that only the "TCodes" between the two ranges should be matched.

    I need "Role" and "TCode" to be output.

    Any help would be greatly appreciated!

    Cheers!

  2. #2
    see if the FinalQuery is what you need.
    also view the "smaller queries".
    they are made according to your criterias.
    Attached Files Attached Files

  3. #3
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    334
    Location
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,137
    Location
    It seems Jay82 is a prolific cross poster. Also at Utter Access as well.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    VBAX Newbie
    Joined
    Feb 2023
    Posts
    3
    Location
    I'm new to the forum space and didn't know ''cross-posting" was a thing until it was mentioned today. First time I've ever done it so good thing is now I'm aware its should be avoided in the future... I came back to this post to link the solution, but June7 beat me to it. My apologies!

  6. #6
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,137
    Location
    Common rule amongst almost the forums that I know.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  7. #7
    VBAX Newbie
    Joined
    Feb 2023
    Posts
    3
    Location
    Your 4k posts to my 2. I've taken this onboard ��

  8. #8
    VBAX Contributor
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    100
    Location
    If you mention you have crossposted and supply links to where, then that generally is OK.?

    Just stops people wasting time duplicating the same or similar advice.

    That is why it is frowned upon when not notified.

    As you say, lesson learnt.

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
  •