List:General Discussion« Previous MessageNext Message »
From:David Arroyo Menendez Date:February 17 2010 8:48am
Subject:Re: count children nodes
View as plain text  
Thanks!

2010/2/16 Peter Brawley <peter.brawley@stripped>

>  David,
>
> >I need count the messages don'tread in a thread.
>
> Have a look at the edge list examples at
> http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html.
>
> PB
>
> -----
>
> David Arroyo Menendez wrote:
>
> Hello,
>
> I've the next table structure:
>
> CREATE TABLE tx_cc20_mensajes (
>     uid int(11) NOT NULL auto_increment,
>     pid int(11) DEFAULT '0' NOT NULL,
>     tstamp int(11) DEFAULT '0' NOT NULL,
>     crdate int(11) DEFAULT '0' NOT NULL,
>     cruser_id int(11) DEFAULT '0' NOT NULL,
>     deleted tinyint(4) DEFAULT '0' NOT NULL,
>     hidden tinyint(4) DEFAULT '0' NOT NULL,
>     remitente int(11) DEFAULT '0' NOT NULL,
>     destinatario int(11) DEFAULT '0' NOT NULL,
>     padre int(11) DEFAULT '0' NOT NULL,
>     mensaje text,
>     leido tinyint(3) DEFAULT '0' NOT NULL,
>
>     PRIMARY KEY (uid),
>     KEY parent (pid)
> );
>
> Where padre is the id of the parent message. I need count the messages don't
> read in a thread. How can I do it?
>
> With
> $query="select count(*) as num from tx_cc20_mensajes msj where hidden=0 and
> deleted=0 and leido=0 and destinatario=".$uid." and remitente<>".$uid." and
> (padre=".$est_row['uid']." or uid=".$est_row['uid'].")";
> I am counting only the first level, but I need count the rest of children
> messages. What is the query?
>
> Thanks!
>
>
>
> ------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.435 / Virus Database: 271.1.1/2691 - Release Date: 02/16/10 07:35:00
>
>
>
>

Thread
count children nodesDavid Arroyo Menendez16 Feb
  • RE: count children nodesGavin Towey16 Feb
  • Re: count children nodesPeter Brawley16 Feb
    • Re: count children nodesDavid Arroyo Menendez17 Feb