|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have two tables a and b with a many to one relationship.
I know its possible to do a join and get as may records back as my many relationship has. But, is it possible to get only one field back as a list. The result would look like this: select id. name, magic_list( table_b_types ) from table_a join table_b on table_a.id = table_b.a_id id, name, table_b_types 1, "Normal Bees", " worker drone " |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Apr 3, 5:15 pm, Leon Williams <noel.ja...@gmail.com> wrote:
> I have two tables a and b with a many to one relationship. > I know its possible to do a join and get as may records back as my > many relationship has. > > But, is it possible to get only one field back as a list. > > The result would look like this: > > select id. name, magic_list( table_b_types ) > from table_a > join table_b on table_a.id = table_b.a_id > > id, name, table_b_types > 1, "Normal Bees", " worker drone " FYI, The magic_list function in the example above is GROUP_CONCAT. So the above sudo query would be something like this select id. name, GROUP_CONCAT( ( select table_b_types from table_b where table_a.id = table_b.a_id ) ) from table_a |
|
![]() |
| Outils de la discussion | |
|
|