You are here: Re: query db to return all related rows to a given row and all related to those and so on and so on.... « PHP Programming Language « IT news, forums, messages
Re: query db to return all related rows to a given row and all related to those and so on and so on....

Posted by Jerry Stuckle on 10/07/88 11:56

monomaniac21 wrote:
> hi all
>
> On a networking site i am working on each user has their own id and the
> id of another person who they are linked to. what i want to do is to be
> able to pull up a list of everyone linked to one person and all the ppl
> linked to them. So the query would work something like get id of linked
> get linked row get id of linked to this person get of person get id of
> linked to person.... this needs to go on until it reaches one person
> who is not linked to anybody. can anyone tell me how to achieve that
> with a control loop?
>
> regards
>
> marc
>

I don't understand. If you're looping through links to other people,
you're *never* going to find anyone who's not linked.

You didn't say which database you're using - but I'd recommend you try a
newsgroup related to your database. You could, for instance, get
everyone linked to a particular person through X levels with one query
in DB2 - but it would be a heck of a query. You probably can do it in
Oracle and SQL Server, also. Don't know about others.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация