Sunday, March 11, 2012

Adding Rows Together in SQL (SQL Server 2000)

Dear friends,
We are trying to achieve the following. Please advice
select a.Firstname,a.Lastname, b.Dev_address,b.dev_description
from tbl1 a, tbl2 b
where b.data_id = a.id
and b.data_id=314
group by a.lastname,a.firstname,b.dev_address,b.dev_descrip tion
aaaabbb4234234Pager
aaaabbb2342342Work
aaaabbb23434Home
aaaabbb23434Cell Phone
kkkccc234234Home
kkkccc23434Cell
We want the result should be as follows:
aaaa bbb4234234Pager2342342Work23434Home23434Cell Phone
kkk ccc234234Home23434Cell
Any ideas would be apprecaited.. we are using SQL Server 2000
Thanks
HOW TO: Rotate a Table in SQL Server
http://support.microsoft.com/default...74&Product=sql
AMB
"Info Request" wrote:

> Dear friends,
> We are trying to achieve the following. Please advice
>
> select a.Firstname,a.Lastname, b.Dev_address,b.dev_description
> from tbl1 a, tbl2 b
> where b.data_id = a.id
> and b.data_id=314
> group by a.lastname,a.firstname,b.dev_address,b.dev_descrip tion
>
> aaaabbb4234234Pager
> aaaabbb2342342Work
> aaaabbb23434Home
> aaaabbb23434Cell Phone
> kkkccc234234Home
> kkkccc23434Cell
> We want the result should be as follows:
> aaaa bbb4234234Pager2342342Work23434Home23434Cell Phone
> kkk ccc234234Home23434Cell
> Any ideas would be apprecaited.. we are using SQL Server 2000
> Thanks
>
|||Thanks a lot. This works great.
|||Rotation works perfect as long as we have one work phone number, if we
have more than one work phone number then it breaks with "Subquery
returned more than 1 value" error message.
Any ideas?

No comments:

Post a Comment