According to your information, there are many relationships between a category and a project. Therefore, you need to model a lot more. Many: many tables store data modeling this relationship.
SQL Fiddle Here
First, create a new table to hold the Many: Many link between the category and the project:
create table tbProjectCategory ( tbProjectId INT, tbCategoryId INT );
Then remove the string-related comma link in tbProject - this is not useful. Instead, paste the links into the Many Many table. eg:.
insert into tbProjectCategory(tbProjectId, tbCategoryId) values (1, 1), (1, 2);
Link project 1 to categories 1 and 2.
Then, to find all the categories for project 1, you need to join the "Many: many" table, filtering by project ID:
select cat.id, cat.name from tbcategory cat inner join tbProjectCategory prjcat on prjcat.tbCategoryId = cat.id where prjCat.tbProjectId = 1;
I also deleted my identifier column for brevity - this makes it easier to find related records.
source share