⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Join fields from different tables within one field



Manuel
  • profile picture
  • Member

Posted 26 November 2020 - 09:29 AM

Hi, I'm new to GC and I've had a problem that I can't solve.
 
In my database I have three tables:
positions (id, name),
employees (id, name)
employee_positions (position_id, employee_id, start_date, end_date)
 
What code do I have to use to get the following result in my final GC table?
 
Employees table: id (789654123Z), name (Manuel), positions (director '2012-2015', secretary '2016-2020')
 
I have done something similar with setRelationNtoN but joining the fields of the same table:
$ crud-> setRelationNtoN ('actors', 'film_actor', 'actor', 'film_id', 'actor_id', '{reference_id} - {first_name} {last_name}');
 
Thank you all!
 
Manuel.