I have these tables:
category_table
+--------+-----------------+---------+
| id | title | parent_id |
+--------+---------------+-----------+
| 1 | f | null |
| 2 | h | null |
| 3 | j | 1 |
| 4 | y | 3 |
| 5 | d | 3 |
+--------+-----------------+---------+
post_table
+--------+---------------+-------------+
| id | title | categoryies |
+--------+---------------+-------------+
| 1 | title1 | 1 |
| 2 | title2 | 1,2 |
| 3 | title3 | 4,5 |
| 4 | title4 | 4 |
| 5 | title5 | 3 |
+--------+---------------+-------------+
and a procedure that find all posts that has '3,5,2' categories.
how procedure will search string list in other string list similar to:
Create Procedure post_select(IN category_ids Varchar(200))
Begin
Select *
From post
Where
// all category_ids exists in post categories column
// such as FIND_IN_SET('1', '1,2,3') but first parameter
// should be list string for example:
// FIND_IN_SET('2,3,4','2,4,5,6,7,8')
End;