From: Peter Brawley Date: May 25 2012 4:31pm Subject: Re: category with parentid List-Archive: http://lists.mysql.com/mysql/227539 Message-Id: <4FBFB3E1.3050107@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-05-25 8:35 AM, hsv@stripped wrote: >>>>> 2012/05/25 14:57 +0700, HaidarPesebe>>>> > id | name | parentid > ---------------------- > 1 | cat A | 0 > 2 | cat B | 0 > 3 | subcat A | 1 > 4 | subcat A | 1 > 5 | subncat B | 2 > ------------------------- > > I want to display the result like this: > > 1. Cat A > - Subcat A > - Subcat A > 2. CatB > - Subcat B It's a graph! See http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html PB ----- > <<<<<<<< > If the degree of subordination is a number in your record, try function REPEAT (output concatenated to A or B), or LPAD. > > ************************************************************** > Scanned by MailScan AntiVirus and Content Security Software. > Visit http://www.escanav.com for more info on eScan and X-Spam. > ************************************************************** > > >