The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

we are talking about a 1-n relationship.
And the deep level will be fixed.

Recursion can be used on the server side scripting side correct? I was just trying to see if, it's possible to use only mysql query and if so, what whould be the inconvenient? Database intensive? (It will be a low traffic website, no more then 1000 visits month I believe).

Thanks a lot for your help on this. It works like a charm.
Instead of UNION ALL I've used UNION because I don't want to retrieve duplicate values on this case, mutatis mutantis, here is the final working code thanks to you:

1) We are putting together the result of two SELECT statements, by using UNION. If one select returns 0, and the other returns some data, we will get that some data. If both return data, we will get the distinct data values of both queries united.

2)
2.1 The first select statement, selects some fields from a given table.
2.2) Then it joins another table (categoria), on a temporary table named c,
2.2.2) on the condition that category id is equal to product category id.
2.3) It then self joins (the same categoria table), and put that result on a temporary table, named c2, on the condition that the first joined categoria row parent_id_cat, is equal to this new table (c2) row id_cat.

2.4)All this will happen only when the parent_id_cat of the newest created table is equal to 1.