web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to run SQL JOIN st...
Power Automate
Answered

How to run SQL JOIN statements with a wildcard with Excel ODBC Driver?

(1) ShareShare
ReportReport
Posted on by 63

I'm currently trying to join two tables in an Excel file using JOIN statement with a wildcard.

PAD and Excel file are connected via ODBC Driver and typical SQL statements (like SELECT, JOIN, etc.) are running fine.

 

kokitabayashi_0-1660101607552.png

 

Test Data:

[TBL_1]

COL_ACOL_B
foobar
aaabbb
cccddd

 

[TBL_2]

COL_CCOL_D
xxxabcfoodef
yyyYYY
aaaAAA

 

[Expected Results]

COL_ACOL_BCOL_CCOL_D
foobarxxxabcfoodef
aaabbb  
cccddd  

 

Using Execute SQL statement, I tried multiple ways but no luck, so far.

Following is some of the trial and error I did.

 

[Case A]

kokitabayashi_0-1660100621332.png

Error

kokitabayashi_1-1660100713460.png

[Case B]

kokitabayashi_2-1660100761580.png

Error

kokitabayashi_3-1660100798570.png

[Case C]

kokitabayashi_4-1660100868136.png

Error

kokitabayashi_6-1660100897913.png

[Case D]

kokitabayashi_7-1660100976918.png

Error

kokitabayashi_9-1660101006510.png

 

[Case E]

kokitabayashi_10-1660101264555.png

Error

kokitabayashi_11-1660101290433.png

 

I tried some more patterns but none of them worked, so far.

I think, the way I use the wild card '%' and 'LIKE' is the reason why it is getting the error but, could not figure out the right way.

 

Just to identify the issue, I also ran the following JOIN statement without a wildcard & LIKE and this ran fine.

kokitabayashi_12-1660101425922.png

Result

kokitabayashi_13-1660101445374.png

 

Would be great if anyone could provide me any help.

Thank you!

 

I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

    I had this problem too and solved it like this:

     

    LIKE '%Param1%%%'

     

    The trick is to escape % (bold) with itself and minding the number of ' 😊

     

    Hope it helps

    /Klaus

  • kokitabayashi Profile Picture
    63 on at

    Hi @Anonymous ,

    Thank you so much for your reply!

     

    Unfortunately, I'm still facing an error. Following is what I have tried so far, based on your suggestion.

     

    [Case A (as you suggested)]

    kokitabayashi_3-1660162994984.png

    kokitabayashi_4-1660163019022.png

     

    Error when I ran it

    kokitabayashi_5-1660163046236.png

     

    [Case B (replaced variable with actual value)]

    kokitabayashi_8-1660163303700.png

    Error when I ran it

    kokitabayashi_9-1660163336520.png

     

    [Case C (replaced variable with actual value & added extra %)]

    kokitabayashi_6-1660163234714.png

    Syntax error

    kokitabayashi_7-1660163260794.png

     

    [Case D (tried removing the single quote)]

    kokitabayashi_10-1660163518799.png

    kokitabayashi_11-1660163544156.png

     

    [Case E (added % to Case D)]

    kokitabayashi_12-1660163639853.png

    Syntax error

    kokitabayashi_7-1660163260794.png

     

    Seems like I'm hitting another road block ...

    Would be great if there any suggestion!

     

  • Verified answer
    ZS440 Profile Picture
    262 on at

    @kokitabayashi 

    hi

    You can do a LEFT JOIN with LIKE as follows.

    CleanShot 2022-08-11 at 12.54.50@2x.png
    Note the use of double quotes.
    Also note that AAA and aaa are considered equivalent in SQL.
    The result will be output as follows.

    CleanShot 2022-08-11 at 12.56.03@2x.png

  • kokitabayashi Profile Picture
    63 on at

    Thanks a lot, @ZS440 !

    This worked perfectly!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 247 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 164 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 138 Super User 2026 Season 2

Last 30 days Overall leaderboard