User_id | flow_id | zone_ids
1 | 1 | 1, 2
2 | 2 | 2 or 3
2 | 3 | 3, 4
Flow process table
Id | name
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1 | accept
For examination and approval of 2 |
3 | completed
Zone subdivision table
Id | name
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1
| Shanghai2 | Beijing
Chengdu 3 |
Hangzhou 4 |
Project project table
Id | name | flow_id | zone_id
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Project id | 1 | | 1
Id 2 | 2 | | project 2
Project id | 3 | 3 | 3
I want to query the project list, a user can approval of the project, how to write a script?
CodePudding user response:
With general INNER JOIN query, the zone_ids 1, 2, the use FIND_IN_SET () function, specifically the use of this function, can be directly baidu or refer to the MYSQL official manual for free,