title: merge databricks SQL of different decimal datatypes
body: <p>I have a Databricks SQL search that results in a data type <code>decimal(18,0)</code>  </p>
  
  <p>I want to append the results of this search into an existing table (<code>df.write.format("delta").mode("append").save("a_path")</code>) but cannot because it has a data type of <code>decimal(38,18)</code></p>
  
  <p>When I try to append, the error I get is:
  <code>AnalysisException: Failed to merge fields 'id' and 'id'. Failed to merge decimal types with incompatible precision 38 and 18 &amp; scale 18 and 0;</code></p>
  
  <p>Is there a way around this?</p>
  
  <p>I tried to cast the result of the search to a decimal(38,18) <code>select cast(id decimal(38,18))...</code> but this did not work</p>
  
  <p>Any suggestions</p>