Home > database >  [with] the mysql record set was generated according to "id_array", in addition to joining
[with] the mysql record set was generated according to "id_array", in addition to joining

Time:12-10

[user table], a primary key id and name the name
ID name
1 posterity
2 money 2
3 threes
4 li si
5 fifty

[grouped table], have a primary key id and user_id
ID user_id
1, 2, 1
2, 3, 4
3 1,3,5
4, 1, 2, 3, 4, 5

Query, will enter [grouped table] the id of the
Want to get/user table name recordset
1 -- such as: input parameters record rally cycle show "posterity, money second"
Such as: input parameters 3 - record rally cycle display "posterity, zhang SAN, fifty"
( note: is a recordset, not string

His thinking about the solution, now only think about with splicing statements from [grouped table] id user_id, generated a select statement, the union rises,

But the feeling is very complicated appearance

I ask, is there any other better solutions?

  • Related