title: SQL DATE Comparison within same table
body: <p>I have a SQL table having below data. I need to compare the date from &quot;Column B&quot; with all the dates present in &quot;Column C&quot; and select the date from &quot;Column C&quot; which is closest to date available in &quot;Column B&quot; but should not be greater than max/min of all dates available in &quot;Column C&quot;.</p>
  <p><a href="https://i.stack.imgur.com/uuaIR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uuaIR.png" alt="enter image description here" /></a></p>
  <p>I am expecting to get result as below. I have tried BETWEEN , DATEDIFF SQL keywords but nothing helped. Any help would be greatly appreciated.</p>
  <p><a href="https://i.stack.imgur.com/T75C7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T75C7.png" alt="Expected Output" /></a></p>