A small problem (SQL+search+array+distinct)
From: Adam Nørregaard (adam.noerregaard_at_e-mail.dk)
Date: 12/29/03
- Next message: Adam Nørregaard: "Re: A small problem (SQL+search+array+distinct)"
- Previous message: Phil Roberts: "Re: PHP Hosting? Where?"
- Next in thread: Adam Nørregaard: "Re: A small problem (SQL+search+array+distinct)"
- Reply: Adam Nørregaard: "Re: A small problem (SQL+search+array+distinct)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Dec 2003 22:18:33 +0100
Hi,
I have this Mysql db:
id int(11) autoincremement prim. key
parentid int(11)
.. etc .. (fields for a discussion board)
When parentid=0 then it is a new thread, otherwise it is a comment to
the thread that has the id that is in parentid (hope you get the
picture)
when I want to search, I issue: select * from forum where (something)
but then for instance I get:
ID,parentid
1,0
3,0
8,3
9,3
11,0
How do I do so:
a) all redundant PARENTID's are limited to one of each, and
b) if a parentid is equal to any id, delete the parentid
It all should end up in a list (arrray) of the ID's relevant.
In the above instance it would be:
1
3
8
9
11
ParenIDs of 0 should be ignored.
I am not very good at english, nor to explain myself, so please do not
hesitate to ask further, or send me to another news group if
appropriate.
Sincerely,
Adam
- Next message: Adam Nørregaard: "Re: A small problem (SQL+search+array+distinct)"
- Previous message: Phil Roberts: "Re: PHP Hosting? Where?"
- Next in thread: Adam Nørregaard: "Re: A small problem (SQL+search+array+distinct)"
- Reply: Adam Nørregaard: "Re: A small problem (SQL+search+array+distinct)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]