How can I get parent categories in mysql query?

My goal is to make the list of parent categories from a nested category the easiest way. Say, if I had a website that sold many different products, one of which is quad Pentium. The function that I can display on my web page is as follows:

Electronics> Computers> Processors> Intel> Intel Quad Core

The table of categories that I had in mind:

ID, parent_id, Description

Running a recursive process on parent_id seems tedious. Is there a preferred way to do this? Thanks.

+3
source share
1 answer

MySQL.

, , , , :

.

+6

Source: https://habr.com/ru/post/1720407/


All Articles