title: Where is null or not equalent value does not return record in mysqli
body: <p>I am trying to fetch the records from two tables.</p>
  
  <p>1 - tokens 2 - transactions</p>
  
  <p>In both tables there is same column user_id and tokens table has transaction_id. I am trying to get all transactions which has relation with token. I am trying following </p>
  
  <pre><code>select sum(`amount`) as aggregate 
  from `tokens` 
  where `user_id` in (15, 713, 49, 58, 60) 
  and exists 
      (select * 
      from `transactions` 
      where `tokens`.`transaction_id` = `transactions`.`id` 
      and (`custom` != 'BB' or `custom` is null)
      )
  </code></pre>
  
  <p>When I change operator in my query like ``custom<code>is not null</code> then I am getting the record, but <code>not</code> means query will show the record of <code>'BB'</code>. </p>
  
  <p>I have searched about it and found a good sentence from this <a href="https://stackoverflow.com/questions/5658457/not-equal-operator-on-null#5658480"><strong>thread</strong></a> </p>
  
  <blockquote>
    <p>NULL Cannot be compared to any value using the comparison operators. NULL = NULL is false. Null is not a value. The IS operator is specially designed to handle NULL comparisons.</p>
  </blockquote>
  
  <p>So in <code>custom</code> I have only one value which is <code>BB</code> and another is <code>NULL</code>.<br>
  My above query is not working. </p>
  
  <p>Can someone kindly guide me how can I resolve the issue?  </p>