Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
vijaykaali811
New Contributor III

pattern matching in ms access query

i have table T1 with  query, name 

T2  table pattern , category

Query  can be anything 

t2 table 

pattern2                     category

connection*failure*    connectivity 

power*failure*             power issue 

i am trying like 

select t1.query, t2.patter,t2.category  from t1,t2 where  query like "*"&t2.pattern2&"*"

but in MS access it says join does not suppport expression  . how to achieve this. 

 

 

 

3 REPLIES 3
v-lgarikapat
Valued Contributor III

Hi @vijaykaali811 ,

 

Thanks for reaching out to the Microsoft fabric community forum.

 

Thanks for sharing your question here Since your issue seems to be related specifically to pattern matching in MS Access queries, Iโ€™d recommend also posting this thread in the Microsoft Access Community. There are many experienced Access developers and experts there who are more focused on Access-specific syntax and behaviour they may be able to offer more targeted assistance.

Database Software and Applications | Microsoft Access

 

Best Regards,

Lakshmi Narayana

 

Shahid12523
Honored Contributor

In MS Access, you canโ€™t use LIKE in the join.

Do this instead:

SELECT t1.query, t2.pattern2, t2.category
FROM t1, t2
WHERE t1.query LIKE "*" & t2.pattern2 & "*";


๐Ÿ‘‰ Put LIKE in the WHERE clause, not the join.

Shahed Shaikh
Avyaktha
New Contributor II

hi vijaykaali811 

 

In MS Access, you can't use a pattern match (LIKE "*"&...&"*" ) as part of a join. Access doesn't allow expressions like that in joins.

But you can still do what you want by writing the query like this:

SELECT t1.query, t2.pattern2, t2.category
FROM t1, t2
WHERE t1.query LIKE "*" & t2.pattern2 & "*";

 

This is how it will work : 
It compares every row in t1 with every row in t2, and filters them where the pattern matches.

BUT If t2.pattern2 has * inside (like connection*failure*), that wonโ€™t work as you expect.
Access uses * as a wildcard, not as a separator. So instead you can store just simple text like connection or failure

Or split pattern2 into multiple columns if you want to check multiple words.

 

Thank you 
Avyaktha 

Helpful resources

Announcements
Top Solution Authors
Top Kudoed Authors
Users online (10,586)