troubleshooting Question

handling multiple results from subquery

Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)Flag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2005SQL
2 Comments1 Solution290 ViewsLast Modified:
i have a table with unique orderID.  i have another table with tech information, and this table also has orderID.  however, there can be multiple rows in the tech table per orderID.

is it possible to SELECT all of the tech names from the tech table as a string separated by commas?  so, if there are two techs for order X, the following would be returned:

Joe, Bob

select column1, column2, column3, (select techName from techTable where techTable.orderID = orderTable.orderID) from orderTable

i can't do the above because techName can have multiple results.  is it possible to format the multiple results to return 1 result from the subquery?

sql server 2005
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros