select rtrim(id)+names from tb

解决方案 »

  1.   

    SELECT RTRIM(ID)+NAMES
    FROM tb
      

  2.   

    select 
      ltrim(id)+NAMES
    from 
      tb
      

  3.   


    select * from tableName a where not exists(select 1 from tableName where NAMES=a.NAMES AND A.ID<ID)
      

  4.   

    select ltrim(ID)+Names as col from tb
      

  5.   

    if object_id('tb') is not null drop table tb 
     go 
    create table tb([ID] int,[NAMES] varchar(10))
    insert tb select 1,'aa'
    union all select 2,'bb'
    union all select 3,'aa'
    union all select 4,'bb'
    union all select 5,'aa'
    union all select 6,'bb'
    union all select 7,'aa'
    go
    select ltrim(ID)+Names as col from tb
    /*
    col
    ----------------------
    1aa
    2bb
    3aa
    4bb
    5aa
    6bb
    7aa
    (7 行受影响)
    */