mysql - Is there a way to get joined tables as array? -


i have user table, education table , work experience table:

users

  • id
  • first_name
  • last_name

education

  • user_id
  • name
  • start_year
  • end_year

workexperience

  • user_id
  • name
  • start_year
  • end_year

now want nice overview of education , work experience of person.

when using regular joins, lot of rows, since number of educations , work experiences multiply number of rows.

the best case if id, first_name , last_name once, array inside educations , work experiences.

could point me in right direction please?

try group by like

select users.*,        workexperience.*,        education.start_year edu_start_year,education.end_year edu_end_year users join education on education.user_id = users.id join workexperience on workexperience.user_id = users.id group id,first_name,last_name 

you can group id also.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -