- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2024 11:54 AM
Hi. If I've posted to the wrong area, please let me know.
I am using SQL to join two tables. One table has the wildcard '%' stored as text/string/varchar. I need to join the value of TableA.column1 to TableB.column1 based on the wildcard in the string being treated as a wildcard.
For example:
TableA.Column1 | TableA.Column2 |
Cat | animal |
Dragon | animal |
Elephant | animal |
TableB.Column1 | TableB.Column2 |
Ca% | Do not eat |
D% | Do not eat |
Ele% | Do not eat |
Ch% | Can eat |
The result is that I want to left join TableB onto TableA like this:
SELECT
A.*, B.Column2
FROM TableA A
LEFT JOIN TableB B
ON A.Column1 like B.Column1
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 07:22 AM
Hi,
Could you please try the query below and let me know if it meets your requirements?
Replace helps us in treating the %' stored in TableB.Column1 as a wildcard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 07:22 AM
Hi,
Could you please try the query below and let me know if it meets your requirements?
Replace helps us in treating the %' stored in TableB.Column1 as a wildcard

