You must Sign In to post a response.
  • Category: SQL Server

    Need the sql query in MS SQL Server

    Hi ,
    I have a table with two fields:FName and LName with following data.
    FName LName
    A B
    A B
    C D
    E F
    I need a query which will get me the following output
    FName LName FullName
    A B AB
    A B AB
    C D
    E F
    For the duplicate record, full name field should have concatenated values.
    I applied the group by query to get only one of the two repeated records.But both repeated records should come in resultset.I tried the following:
    select FName,LName,
    when count(*) > 1 then FName+LName
    else ' '
    end as 'FullName'
    from <tablename> group by FName,LName
  • #769371
    your Requirement not clear.let me know more details.


  • Sign In to post your comments