Filter duplicate rows based on a field

后端 未结 4 848
余生分开走
余生分开走 2021-01-01 23:39

I have several records (bills) that are basically duplicates of each other, except for one field, which represents the language that bill is in.

For example:

<
4条回答
  •  死守一世寂寞
    2021-01-02 00:30

    select
    ID,BillID,Account,Name,Amount,max(Lang)
    FROM Bills 
    WHERE Account='abcd'
    group by BillID,Account,Name,Amount;
    

    Given that you are not giving priority to any specific language if there is same bill in multiple languages. The above query will work perfect.

    EDIT : Removed "ID" from group by. @Phil You are right..!!

提交回复
热议问题