title: How to perform a LEFT JOIN joining on fields only if not null?
body: <p>I have a table of items which are categorised in up to three buckets: <code>cat1</code>, <code>cat2</code> and <code>cat3</code>. I want to apply a label to each row based on a lookup table which specifies the minimum conditions for each label: for example, some labels may have the condition that cat1 and cat2 are particular values but cat3 is specified as null - i.e. it can be any value.</p>
  <p>For example, if these are the <code>itemData</code> and <code>lookupTable</code> tables below</p>
  <p><a href="https://i.stack.imgur.com/cLOck.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cLOck.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/sPB9b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sPB9b.png" alt="enter image description here" /></a></p>
  <p>I want to return the following values:</p>
  <p><a href="https://i.stack.imgur.com/IPlqp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IPlqp.png" alt="enter image description here" /></a></p>