Re: Re: lug-bg: MySQL query (2)
- Subject: Re: Re: lug-bg: MySQL query (2)
- From: tpenev@xxxxxx (Teodor Penev)
- Date: Tue, 19 Nov 2002 17:22:18 +0200 (EET)
Ami, ne si prochel dobre post-a mi Georgi :)
Ne pitah kak da se izkarvam ot db otdelno parents & children
threads, a zaedno:
parent2
child0
childr1
...
parent1
child0
child1
...
v tozi vid.
>Tova koeto go pishesh go pishesh po mnogo greshen nachin. Triabva
>ti neshto ot sorta (mnogo elementarno i dyrveno napraveno v sluchaia)
>
>create table posts (
> id serial,
> parent int default null
> ts int,
> subj text,
> text text
>);
>
>v parent poleto pishesh na koi post e otgovora. Ako e null
>znachi e tema.
>
>posle imash pokazvane na postove (50-te nai-novi)
>
>select * from posts where parent is null order by ts desc limit 50;
>
>imash i pokazvane na thread
>
>select * from posts where id = XXX or parent = XXX order by ts;
>
>Gore dolu tova e ( - greshkite :)
>
>Estestveno v istinski forum shte e hubavo da pazish BODY-to na posta
>otdeleno ot subject (za po byrzo tyrsene) i shte imash oshte danni
>koi go e postnal IP, proxy, etc.
>
>Otidi na www.phorum.org i si svali soft-a. Razgledai strukturata na
>DB-to i go razberi. Tozi forum raboti s mysql i postgres taka che niama
>da sreshtnesh "mysql only braindamage".
>
>
>--
>Georgi Chorbadzhiyski
>http://georgi.unixsol.org/
>
>============================================================================
>A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
>http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
>To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
>============================================================================
>
-----------------------------------------------------------------
http://imot.GBG.bg - Èìîòúò, êîéòî òúðñèòå.
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|