title: Resolve collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS"
body: <p>How can I fix this?</p>
  <p>If I delete line 2, query work exactly.</p>
  <pre><code>SELECT case when ID_DonVi_Di &gt; 0 then 'dv'+cast(ID_DonVi_Di as nvarchar) else MaChiNhanh_Di end as ID_NoiDi
      , case when ID_DonVi_Di &gt; 0 then dvdi.Ten_DonViNgoai else cndi.TenChiNhanh end as NoiDi 
      , case when ID_DonVi_Den &gt; 0 then 'dv'+cast(ID_DonVi_Den as nvarchar) else MaChiNhanh_Den end as ID_NoiDen
      --, case when ID_DonVi_Den &gt; 0 then dvden.Ten_DonViNgoai else cnden.TenChiNhanh end as NoiDen
  FROM 
      [dbo].[ToTrinh] a
  left join
      dbo.DM_CHINHANH cndi on a.MaChiNhanh_Di = cndi.MaChiNhanh COLLATE Latin1_General_CI_AS
  left join
      dbo.DM_CHINHANH cnden on a.MaChiNhanh_Den = cnden.MaChiNhanh COLLATE Latin1_General_CI_AS
  left join
      [dbo].DM_DonViNgoai dvdi on a.ID_DonVi_Di = dvdi.ID_DonViNgoai
  left join
      [dbo].DM_DonViNgoai dvden on a.ID_DonVi_Den = dvden.ID_DonViNgoai
  where a.TonTai = 1
  </code></pre>
  <p><a href="https://i.stack.imgur.com/jpUVI.png" rel="nofollow noreferrer">enter image description here</a></p>