Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Add a column based on a select query

Author  Topic 

KenA
Starting Member

28 Posts

Posted - 2006-03-05 : 00:42:20
Supose I have the following select:

Select Name, Age, (select TelNums from Telephone)
From Person

The problem is that (select TelNums from Telephone) can return more than 1 record:

tel1
tel2
.
.
.

I was wondering how I can make a select to return the tel numbers like: 'tel1,tel2,tel2'

»»» Ken.A

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-05 : 00:46:18
see here http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx

----------------------------------
'KH'


Go to Top of Page

KenA
Starting Member

28 Posts

Posted - 2006-03-05 : 07:59:56
Thanks ... that anwered my question. But now I´m in doubt whether doing it or not.
Since my query doesn´t return large amounts of data, I believe it´s ok to use it.

»»» Ken.A
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-06 : 00:28:18
The referred link is the way to go if you want to do this in SQL query

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -