In a one-to-many scenario, we use a comma concatenation to store, avoid storing multiple, or sub-table, then there is a storage on the need to modify if necessary, it brings difficulty, such as the Rule record table as follows
If the 2nd rule is deleted, then all of this table has 2 records to be cleared out, at this time the problem is troublesome, you need to determine whether to use Find_in_set and then take out the loop, remove 2, and then loop write, if a different way of thinking with a string to solve, then it is convenient for the specific program as follows
This idea is very peculiar, the use of string substitution, all the string before and after the comma, and then, 2, for, and then filter the comma, so that you can replace the things you need to substitute, and start I want to directly replace, I found that if 2 just at the beginning or the end, it is easy to have problems, then after thinking , it is better to transform this field, the field before and after the comma, so that the match can be replaced, the efficiency is more efficient than to detect and recycle and then cycle the update efficiency is much higher ah, but things are handed to the database to do, maybe the database pressure to answer some. There must be some lost ah, haha ha! Reminds me of the team leader to leave three days, the team leader is very cool, colleagues to work the kind of uncomfortable, ha ha, a flower open, there is a flower defeat, the inevitable truth of the development of things ah, ah haha ha!
How to remove one of the elements in the MySQL field collection