Sql join with like condition not working for non exact matches
I am trying to join my expenses table with like query to categorize them into defined categories. I am trying if my expenses table even have a mention of a full keyword from lookup table, it should categorize them. Example, it does not show ‘fine Esso brampton’ categorized as ‘Gas’. But the like join only works for exact match. Please suggest what’s the issue here:
SQL query LEFT JOIN two tables with WHERE clause for the second table’s column
Table1: Id1, Phrase Data: 1 Hello 2 Bye 3 Thanks Table2: Id2, Color, Shape Data: 1 Green Square 3 Yellow Circle 3 Blue Square The requirement for the query is to return ALL rows from Table1 left joined with Table2 where Shape = ‘Square’, i.e. 1 Hello Green 2 Bye NULL 3 Thanks Blue Query […]
SQL query left join two tables with WHERE clause
Table1: Id1, Phrase Data: 1 Hello 2 Bye 3 Thanks Table2: Id2, Color, Shape Data: 1 Green Square 3 Yellow Circle 3 Blue Square The requirement for the query is to return ALL rows from Table1 left joined with Table2 where Shape = ‘Square’, i.e. 1 Hello Green 2 Bye NULL 3 Thanks Blue Query […]