Home > Back-end >  Mysql league table query how to return a list of Adrian rodriguez huber -) fernando, the two fields
Mysql league table query how to return a list of Adrian rodriguez huber -) fernando, the two fields

Time:12-26

Existing three table, a review task list, review tasks associated with expert table, many-to-many relationship, but the list includes participants and experts, the two roles through a field to distinguish, but at the time of return to review task, need to put participants and experts to review the task, the SQL should be how to write

CodePudding user response:

 select rw. * 
, (the select group_concat (what zj had. ZJXM) from what zj had designed table home where what zj had. ZJID in (select glA. ZJ_ID from experts task associative table glA where glA. RW_ID=rw. RWID)) experts name
, (the select group_concat (what zj had. ZJXM) from what zj had designed table home where what zj had. ZJID in (select glB. ZJID from attendees associative table glB where glB. RW_ID=rw. RWID)) attendees name
From the task table rw


Experts names, names of attendees found out to comma separated

CodePudding user response:

What database? Different database row transfer column method

CodePudding user response:

Table design is unreasonable, the middle two tables, 2 for one, it'll be a lot more good to check

CodePudding user response:

The database design, the relationship in the middle of the table with a piece of table doesn't it just add a field, after the one thousand plus a interns, add list of xx
Do you want the SQL statement, hole hole in two relational table
I can't do a little test result, can only give you some ideas


In fact, is the best way to change a relational table into a, query Sql good write back or extension
  • Related