sql - inner join on null value -


I'm not sure I made a mistake in the argument.

If I have a query and I do an internal insertion with a null value, will not I always get any result or will it be neglected to join and succeed? Example:

  User {ID PK, Name NVRARR Noel, BENSTATUS NULL REFERENCES}  

If I write and U. Bennetus will not find a line for me?

  Choose from the user * Join u as bensetatus as u. Bb.id = b.id where id = 1  

if there is a tap included You do not get a line because NULL can not be equal to something, even zero as well.

If you change it then join the left, then you will get a line.

With an internal joining:

  select * Include the user as * u in the form of BENSTATUS in B. Status = BID1, '1', 1, 'Restricted'  

With a left join:

  Select as user * This Using test data:  
  

Code> Create a tablet user (ID int, bankstats newcomer (100)) ; Enter the User (ID, Bankstats) values ​​(1, '1'), (2, 'NULL'); Create table lencetates (id int, text nvarchar (100)); Include Banstatus (id, text) values ​​(1, 'restricted');


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -