April 16, 2009 at 11:40 pm
Dear friends,
I need to merge two column when i use select query example...
My table having..
code name
1 sara
1 Jhon
2 ram
2 rahim
select code,name from detail where id = 1
O/P is
1 sara
1 jhon
but i need to Show with single row
O.p should be..
1 sara/Jhon
Any possible to merge two records?
Please Help me..
Very Urgent..
April 17, 2009 at 12:35 am
in a rush but will give a sample code and you can work around it based on your requirement.
DECLARE @colList varchar(8000)
SELECT @colList = COALESCE(@colList + ', ', '') + tblcol
FROM test
WHERE id = 3193
SELECT @colList
April 17, 2009 at 12:56 am
THANKS FOR YOUR REPLY..................THANKS SO MUCHHHH
April 17, 2009 at 1:22 am
If you need to expand this solution to a set of record, you can view this article, to see another interesting ways:
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply