|
|
Subject:
SQL
Category: Computers > Programming Asked by: universityresource-ga List Price: $30.00 |
Posted:
03 Nov 2004 04:56 PST
Expires: 04 Nov 2004 05:16 PST Question ID: 423817 |
Hi, We would like the SQL for the following: We have a data set in two tables in MySQL on PHP. Table1 contains data, table2 contains relationships between items in table1 Table1 Entry_id Notes Table2 PrimaryKey Up (contains a Table1.entry_id) Down (contains a Table1.entry_id) This is the data: 1 2 3 4 5 6 7 8 9 10 The numbers refer to entry_id's of notes in table1. The positions refer to the relative organization in table2. We would like the data to display in the following order: 1 3 7 8 4 5 9 10 2 6 If you need sample data or more detail I can provide. | |
| |
| |
| |
| |
|
|
There is no answer at this time. |
|
Subject:
Re: SQL
From: mathtalk-ga on 03 Nov 2004 18:45 PST |
Unfortunately recursion, which is implicit in finding depth first search order here, is not a strong point of SQL. One would need to emulate recursion through some iteration, which implies procedural programming. SQL is primarily a declarative programming language, largely based on first-order logic. However many SQL implementations, including MySQL starting with version 5.0, allow for a variety of procedural constructs including iteration (looping) within the framework of stored procedures (or in scripts, for some implementations). With MySQL 4.0 my guess would be that some reliance on PHP code calling into the database repeatedly is the cleanest approach. regards, mathtalk-ga |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |