MySQL: select, group by and transform rows to separate columns :)
问题 I need to ask you for help with MySQL select query. Specific example: employees with the spouse and kids. I have 2 tables already joined into one and now I need to: 1, select the data with grouping them by 'emp' field 2, transform the result with these rules: only one row with particular emp (emp-A, emp-B, emp-C) each relative (spouse and kids) in succeeding columns (spouse first, kids next) The table (in fact two joined tables): +---------+-----------+-----------+------------+ | emp |