From: Peter Brawley Date: March 27 2006 3:29pm Subject: Re: Complicated select query List-Archive: http://lists.mysql.com/mysql/196201 Message-Id: <442804F5.8090807@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Barry, > Hello Everyone! > > Probably somone can help me out. > > I have 2 databases and it looks like: (Wayne Ratliff is dead but his mistake lives on :-) ). You mean tables, right? > db1 Project 1 > db2 Subproject 1 > db2 Subproject 2 > db1 Project 2 > db2 Subproject 1 > db1 Project 3 > db2 Subproject 1 > db2 Subproject 2 > db2 Subproject 3 > > What kind of a query would give me the first Subproject out of dv2 of > each Project in db1? A hierarchical query, ie a query which traverses the data as a graph. They're doable in MySQL, eg see http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html. A simple nodes-and-edges (Edge List) model should do fine for your problem. PB > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.1/292 - Release Date: 3/24/2006