Monday, March 12, 2012

Group By then Concatenate strings

Hi There,
is it possible to Concatenate strings using group by
Select Concatenate (Name) from table1 group by dept
Thanks
GaneshHi, Ganesh
See: http://www.aspfaq.com/show.asp?id=2529
Razvan|||Ganesh
Please tell us what is the result ?
CREATE TABLE #test
(
FirstName VARCHAR(100) NOT NULL,
LastName VARCHAR(100) NOT NULL,
Dept INT
)
INSERT INTO #test VALUES ('Bill','Smith',100)
INSERT INTO #test VALUES ('John','Lee',100)
INSERT INTO #test VALUES ('David','Litvak',200)
INSERT INTO #test VALUES ('Alex','Boon',200)
SELECT * ,FirstName+' '+LastName AS SurName
FROM #test
"Ganesh" <ganeshsankaran@.hotmail.com> wrote in message
news:C222CA3D-346A-4A95-AB33-4EDA626E7B9A@.microsoft.com...
> Hi There,
> is it possible to Concatenate strings using group by
> Select Concatenate (Name) from table1 group by dept
> --
> Thanks
> Ganesh

No comments:

Post a Comment