List:General Discussion« Previous MessageNext Message »
From:Douglas Sims Date:September 27 2006 2:57pm
Subject:Re: Count of children
View as plain text  
By default it doesn't, but you can change that behaviour.  Quoting  
from this page http://dev.mysql.com/doc/refman/5.0/en/stored- 
procedures.html :

Recursive stored procedures are disabled by default, but can be  
enabled on the server by setting the max_sp_recursion_depth server  
system variable to a nonzero value. See Section 5.2.3, “System  
Variables”, for more information.

There is also a very thorough article discussing stored procedures in  
MySQL which gives an example of tree traversal here:
http://dev.mysql.com/tech-resources/articles/mysql-storedprocedures.html

Douglas Sims
Doug@stripped



On Sep 27, 2006, at 9:40 AM, João Cândido de Souza Neto wrote:

> You must do that by a some language script, unfortunatly mysql is no
> recursive.
>
> ""André Hänsel"" <haensel@stripped> escreveu na mensagem
> news:32fa01c6e23d$66cf1e50$0700a8c0@lappyandre...
> Sorry, my english sentence was imprecise. :) I want the count of all
> sub-entries AND THEIR sub-sub-entries.
>
> Example:
>
>     A
>    / \
>    B C
>     / \
>     D E
>        \
>        F
>
> So I want to know that C has 3 sub-nodes.
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: Rob Desbois [mailto:robert.desbois@stripped]
>> Gesendet: Mittwoch, 27. September 2006 15:48
>> An: André Hänsel; mysql@stripped
>> Betreff: re: Count of children
>>
>> André,
>>
>> Your sentence 'I want the count of all sub-entries for a
>> specific entry' converts straight into SQL:
>>
>> 'I want'
>>     SELECT
>> the count of all entries
>>     COUNT(*) FROM myTable
>> with a specific parent
>>     WHERE parent_id = 5
>>
>> You've missed one of the major benefits of SQL - it's
>> designed to read like an English sentence!
>> --Rob
>>
>>
>> _____________________________________________________________________ 
>> _
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
>> _____________________________________________________________________ 
>> _
>>
>> -- 
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:
>> http://lists.mysql.com/mysql?unsub=1
>>
>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1

Thread
Count of childrenAndré Hänsel27 Sep
  • Re: Count of childrenjoao27 Sep
  • re: Count of childrenRob Desbois27 Sep
    • AW: Count of childrenAndré Hänsel27 Sep
    • Re: Count of childrenjoao27 Sep
      • Re: Count of childrenDouglas Sims27 Sep
  • Re: Count of childrenPeter Brawley27 Sep
    • AW: Count of childrenAndré Hänsel27 Sep
      • Re: AW: Count of childrenddevaudreuil27 Sep
      • Re: AW: Count of childrenPeter Brawley27 Sep
        • RE: AW: Count of childrenRobert DiFalco27 Sep