Search code examples
mysqlsqlleft-joinresultset

SQL Query shows no result with left join


I have the following query:

SELECT u.user_id, u.username, u.email
                   hp.homepage_id
              FROM table_u u
              LEFT JOIN table_hp hp
                ON (u.user_id = hp.user_id)
             WHERE u.blocked = 'N'
               AND u.email LIKE 'someemailaddress'

I am joining on the user_id column, for the given emailadress I know both properties are the same so I should get a result but still I don't get any result... so what is wrong with this query?


Solution

  • The point was how some data was stored in the database... Seems that in an old (buggy) version of the application data was stored without decent trimming etc. The issue was the field was stored in with a whitespace...

    Stupid... should/must had checked the actual data that was stored...