Link to home
Start Free TrialLog in
Avatar of Evan Cutler
Evan CutlerFlag for United States of America

asked on

add comma-delineated column into SQL output

I have this SQL:
      SELECT A.PK, A.Title, LEFT(A.Text, 25) + '...', a.date_entered, C.Concentration
      from Advertisements A
      join  [Concentration-Advertisement] CA
      ON A.PK = CA.FK_Advertisement
      join Concentrations C
      ON CA.FK_Concentration = C.PK;

the C.Concentration field lists the field that the Advertisement is associated with.
what happens is rows repeat Advertisement info, because it is a 1 to many ratio.

Instead, I want the C.Concetration to represent a comma-delineated list of the concentrations for one row per advertisement.

Below is the table reference...
Advertisement
============
PK, Title, Text, Date

Concentration-Advertisement
========================
PK, FK-C, FK-A

Concentration
===========
PK, Concentration

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of pivar
pivar
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Evan Cutler

ASKER

And that's why your the sage :)

Thanks