从数据列表中删除重复的文本 [英] remove duplicate text from datalist

查看:50
本文介绍了从数据列表中删除重复的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的查询,下面是代码:

I have simple query below is the code:

"Ag Silver I  0.80 0 Negative
Ag  Silver II 1.08 0 Negative "

我只想删除内部联接中两次出现的" Ag,所以如果数据列表包含多个时间,我只想显示序列号和" Ag名称唯一. />
我想要这样:

i just want to remove the "Ag" which is coming twice from the inner join so i just want to show serial no and "Ag" name unique if datalist contain multiple time .

I would like this :

"1. Ag Silver I  0.80 0 Negative
    Silver II 1.08 0 Negative "


希望我的查询不会变得复杂
谢谢


Hope my query is not getting complex
Thanks

推荐答案

一个例子:
an example:
SELECT case when t.rowno=1 then CompanyName else null end as CompanyName, Product, Price, NrOrdered, Status
    FROM
        (
            SELECT Row_Number() over (partition by CompanyName order by CompanyName ) as rowno
            , CompanyName, Product, Price, NrOrdered, Status
FROM    YourTable
        ) as t


这篇关于从数据列表中删除重复的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆