The number of differences in a column

后端 未结 5 1184
情深已故
情深已故 2021-01-29 07:18

I would like to retrieve a column of how many differences in letters in each row. For instance

If you have a a value \"test\" and another row has a value \"testing \", t

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-29 07:51

    I think you just want len() and lead():

    select t.id, t.value, t.category,
           (len(lead(value) over (partition by t.category order by t.id) -
            len(value)
           ) as difference
    from t;
    

提交回复
热议问题