Relate Subcategory Categories from the same table to another table
I have the following tables:
Sofar,Ithinkthemodelingisok,right?
ThenintheresultIwouldliketosearchforthefollowingfields:
id_manual|titulo|arquivo|downloads|id_categoria|id_subcategoria|categoria|subcategoria-
Idonotwanttoconcatenatethecategoryandsubcategoryfields.
Even though I am joining the two tables, but the fields are not getting right, what I would like is that in the category field, it would be the name of the category and if it has subcategory the name of the subcategory would be in the field subcategory, consequently this for the id_categoria
and id_subcategoria
fields.
How could I do this without concatenating the fields (do with separator fields)? or just filtering using PHP?
I would like to just do a Query with MySQL for this, if at all possible.