Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to Concate more than one rows in one row ?.

How to Concate more than one rows in one row ?.

Scheduled Pinned Locked Moved Database
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fazal Vahora
    wrote on last edited by
    #1

    I Want to display more than one rows data in just one row. My Data is: Code Name 50141 abc 50141 pqr I want Following Data in result. Code name 50141 abc,pqr Please Give me a solution. Thanks & Regards, Fazal

    I 1 Reply Last reply
    0
    • F Fazal Vahora

      I Want to display more than one rows data in just one row. My Data is: Code Name 50141 abc 50141 pqr I want Following Data in result. Code name 50141 abc,pqr Please Give me a solution. Thanks & Regards, Fazal

      I Offline
      I Offline
      infneeta
      wrote on last edited by
      #2

      Create Function to return the all names(seperated by comma) for a given code. Create FUNCTION [dbo].[GetNamesById] ( @code int ) RETURNS varchar(max) AS BEGIN declare @result varchar(max) select @result = COALESCE(@result + ',', '') + [name] from tblCode where code = @code return @result END GO now use following query: select code,dbo.GetNamesById(code) from tblCode group by code above query will give output as: Code name 50141 abc,pqr

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups