troubleshooting Question

flattening out multiple rows

Avatar of kj96ee
kj96eeFlag for Afghanistan asked on
Microsoft SQL Server 2005Microsoft SQL Server 2008Microsoft SQL Server
4 Comments1 Solution235 ViewsLast Modified:
Could somebody please help a beginner out with this one!  

B has a many-to-one relationship to A,

so this query

select
a.name,
b.date

from a

join b
on a.name = b.name

would normally return
name1,date1
name1,date2
name2,date1
etc.  

Instead,
I want to return a flat file looking like this:

name1,date1,date2,,,,
name2,date1,,,,,

 

Up to 6 dates in the flat file, and I need to have the dates in descending date order.  

Thanks.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
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 4 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