Re: [GENERAL] Converting join'ed rows into a comma or space delimited list

2010-08-12 Thread Mike Christensen
Thanks! Yup the LEFT JOIN is probably a cleaner syntax over the nested query.. On Thu, Aug 12, 2010 at 1:37 AM, Thom Brown wrote: > On 12 August 2010 09:16, Mike Christensen wrote: >> Damn I'm the master at posting stuff then figuring it out like 5 >> seconds later..  Is there an approach bette

Re: [GENERAL] Converting join'ed rows into a comma or space delimited list

2010-08-12 Thread Thom Brown
On 12 August 2010 09:16, Mike Christensen wrote: > Damn I'm the master at posting stuff then figuring it out like 5 > seconds later..  Is there an approach better than this? > > select RecipeId, Rating, array_to_string(ARRAY(select Tag from > RecipeTags where RecipeId = R.RecipeId), ' ') from Reci

[GENERAL] Converting join'ed rows into a comma or space delimited list

2010-08-12 Thread Mike Christensen
I have the table recipes (ID/Name): 1 - Pancakes 2 - Chicken dish 3 - Tacos Then I have the table RecipeTags (RecipeID/Tag) 1 - A 1 - C 2 - A 2 - D 3 - E 3 - F 3 - G I want to query for all recipes, but join in the recipe tags. However, rather than having a row for each recipe tag, I want to co

Re: [GENERAL] Converting join'ed rows into a comma or space delimited list

2010-08-12 Thread Mike Christensen
Damn I'm the master at posting stuff then figuring it out like 5 seconds later.. Is there an approach better than this? select RecipeId, Rating, array_to_string(ARRAY(select Tag from RecipeTags where RecipeId = R.RecipeId), ' ') from Recipes R; On Thu, Aug 12, 2010 at 1:12 AM, Mike Christensen