Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Product_Id Description
  2. BX01 Desc 1
  3. BxX1 Desc 2
  4. Dss3 Desc 3
  5. HHXY Desc 4
  6.  
  7. DECLARE @ProID VARCHAR(8000)
  8. SELECT @ProID = COALESCE(@ProID + ' - ', '') + Product_Id FROM TABLE
  9. SELECT @ProID
  10.  
  11. SELECT GROUP_CONCAT(
  12. CONCAT( @rownum := @rownum + 1, '-', Product_Id )
  13. SEPARATOR ','
  14. ) AS data
  15. FROM table, ( select @rownum := 0 ) r
  16.  
  17. SET @a:=0;
  18.  
  19. SELECT CONCAT( @a:=@a+1,'-',Product_Id) FROM TABLE ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement