Distinct in SQL Server

后端 未结 1 1553
野性不改
野性不改 2020-12-21 11:12

I am executing the following query,

Select distinct
  a.cr_id,
  Case 
    When ca.ca_vote = \'Approve\' and ca.ca_title=\'MANAGER\' Then ca.ca_email
    Whe         


        
相关标签:
1条回答
  • 2020-12-21 11:36

    Distinct is applied to all columns, not the one which is immediately after Distinct.

    If you have several different ca_email for a cr_id, you will see them all.

    If you don't want that, you have to come up with a rule to decide what record among the duplicates must stay.

    0 讨论(0)
提交回复
热议问题