Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to flatten relationship

Status
Not open for further replies.

SueRobbins

Programmer
Nov 12, 2001
13
US
Having trouble with a query. Here's a simplified version of the two tables involved:

Table - "Name"
NameID Name
001 Brown
002 Smith
003 Jones
004 Adams

Table - "Color"
ColorID NameID Year Color
001 001 2003 blue
002 001 2004 blue
003 001 2004 green
004 002 2003 blue
005 002 2004 red
006 003 2003 blue
007 004 2003 blue
008 004 2004 yellow
009 004 2004 blue
010 004 2004 green

I want the end result of the query to show name and all colors for a given year, but I need the color(s) to be formated as a single string. So, for 2004 the result should be:
Name Colors
Brown blue,green
Smith red
Adams yellow,blue,green

Can someone steer me in the right direction to accomplish this?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top