title: error message: "Msg 206, Level 16, State 2, Line 1 Operand type clash: int is incompatible with date"
body: <p>I want to convert it from datetime to date dataype. Can someone answer this? Thanks.</p>
  
  <pre><code>select 
  
  (case when (t0.InvType = '13') then (select (cast(DocDate as date)) from OINV 
  where DocEntry = t0.DocEntry and t0.InvType = '13'))
  
       when t0.InvType = '18' then (select (cast(DocDate as date)) from OPCH where DocEntry = t0.DocEntry and t0.InvType = '18')
        when t0.InvType = '19' then (select (cast(DocDate as date)) from ORPC where DocEntry = t0.DocEntry and t0.InvType = '19')
        when t0.InvType = '204' then (select (cast(DocDate as date)) from ODPO where DocEntry = t0.DocEntry and t0.InvType = '204')
        when t0.InvType = '30' then (select (cast(DocDate as date)) from OJDT where TransId = t0.DocEntry and t0.InvType = '30')
        else 0
              end) as MonthQ
  </code></pre>