Re: Crosstab?



Can you do it in the client? This kind of thing is extremely inefficient in
SQL Server.

If you must do it in SQL Server, refer to the following:

http://www.aspfaq.com/show.asp?id=2529


--
Adam Machanic
Pro SQL Server 2005, available now
www.apress.com/book/bookDisplay.html?bID=457
--


"Jon Derbyshire" <JonDerbyshire@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E476C459-477C-4882-A705-674A19D20198@xxxxxxxxxxxxxxxx
> Hi,
>
> I run the following query "SELECT * FROM tbl_A", and get the following
> result set:
>
> Surname Firstname
> Smith John
> Smith Richard
> Smith Simon
>
> What I want to see in my result set is:
>
> Surname Firstname
> Smith John, Richard, Simon
>
> How do I achieve this?
>
> Thanks
>
> Jon Derbyshire


.



Relevant Pages

  • Re: Slow execution of a stored procedure
    ... '%' sign in front of the @strField parameter ... > SurName AS FirstName+' '+ LastName ... For the first time your run SP SQL Server determine ...
    (microsoft.public.sqlserver.programming)
  • Validation Text
    ... I have set up constraints for a table in SQL Server 2000 Enterprise ... Manager, The consraints are only simple ie: ([Surname] is not null) we ...
    (microsoft.public.sqlserver.programming)
  • Re: Creating index on two columns
    ... >and I use the following stored procedure to do a SELECT which I use on ... >My first thought was to index the Name and Surname columns, ... That index would only be useful if you would make it the clustered index ... faster than using the index on, so SQL Server should ...
    (microsoft.public.sqlserver.server)
  • Re: Retrieving Table ID
    ... Assuming you are using SQL Server, ... Customer(ForeName, SurName) VALUES; ... Change your update statement from ... Forename and Surname. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Passing a Parameter to a Form when Opening
    ... The best thing is first to look at the capabilities of the SQL server ... > CustID, Surname, Forename and address of all people with that surname. ... > The correct customer is then selected from the datagrid and I want to open ...
    (microsoft.public.dotnet.general)

Loading