Left Join not producing nulls
I have two tables like this :
website_session_id landing_page '1', '/home' '2', '/home' '3', '/home' '4', '/home' '5', '/home' '6', '/home' '7', '/home' '8', '/home' '9', '/home' '10', '/home' website_session_id '1' '2' '3' '4' '5' '7' '8' '9' '10'
I am using LEFT Join to connect both table, the website_session_id with value 6 is not shown at all.Isnt it supposed to show something like
6 /home NULL
SQL QUERY :
SELECT * FROM session_first_view LEFT JOIN bounced_sessions ON session_first_view.website_session_id = bounced_sessions.website_session_id
Just check the table name : assume First Table Name is T1 and second Table is T2 the join condition is as below , wherein T1 has 2 column as mentioned
SELECT * FROM T1 LEFT JOIN T2 ON T1.website_session_id = T2.website_session_id
If your first table is session_first_view
it should work
http://sqlfiddle.com/#!9/81e8b06/1
Unless the first table effectively has no record with website_session_id=’6′. Please check your table data.
Also, you can check if you are getting null results using
SELECT * FROM session_first_view LEFT JOIN bounced_sessions ON session_first_view.website_session_id = bounced_sessions.website_session_id WHERE bounced_sessions.id IS NULL
It should display at least this one with website_session_id='6'