MySQL GROUP_CONCAT getting data from 2 tables and linking table -


i trying use mysql group_concat aggregate data 2 tables linked linking table. display useful data rather ids.

if following query:

select pid, group_concat(vid) bs_prod_vars group pid

i correctly following:

pid     group_concat(vid) --------------------------------------- 1       1,2,3,4,5,6 2       9,10,11,4,12,8,6,1,2,5,3,7 3       2,13,3,1,11,4,6,10,9,5,12,8,7 4       2,6,5,3,4,1 5       1,11,3,12,5,9,10,6,8,4,13,2,7 8       14 

if this:

select p.name, group_concat(v.name)  bs_products p, bs_variations v, bs_prod_vars pv  pv.pid = p.id  , pv.vid = v.id  group p.name 

i 2 rows follows:

name                group_concat(v.name) ------------------------------------------------------------- test product      pre-2012 test product b      2008 - 2010,2002 - 2012,from 2011,2002... 

what doing wrong second query?


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -