Hi,
I tried to do this my self but I'm not a DBA and am new to MySQL (I work with Oracle mostly, and have a team of DBAs who do this stuff for me, but this job is for a different company so I cant use my team) so I thought I'd ask you guys for an idea on how I can do this:
I have two tables, defining a graph:
t_Items and t_Relations.
t_Items is basically a list of items, identified by a unique ID.
|ID | Name
---------------
| 0 | item 0
---------------
| 1 | item 1
---------------
| 2 | item 2
---------------
| 3 | item 3
---------------
t_Relations defines relations between two items.
| FirstID | SecondID
------------------------
| 0 | 1
------------------------
| 1 | 3
------------------------
| 3 | 5
------------------------
This means I have a graph of nodes with relations between them (in both directions).
What I need is a stored procedure which selects all the "Routes" from one node to another and logs them in another table: t_Routes.
The way it would be used is - I would call a stored procedure (I'm using MySQL 5) giving it two Node IDs as parameters.
Then I'd be able to select all the rows from t_routes for these two IDs and I'd have a row for each route.
How can I do this? I racked my head for several days and couldnt come to a solution which worked. I heard there are some briliant minds (DBAs

) here so I hope you dont let me down!!
Thanks for any help or advice you may be able to give!
Gidi