Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: mysql DBI Nested Queries

by CountZero (Bishop)
on Dec 23, 2012 at 14:00 UTC ( #1010096=note: print w/replies, xml ) Need Help??

in reply to mysql DBI Nested Queries

Unfortunately MySQL does not have recursive SQL capabilities, so the recursion will have to be done in Perl, which makes this kind of work rather slow since you will have to climb the adjacency tree node-by-node.

There are other solutions though, but they all mean that you will have to change your datatables. The most flexible and still fast model is probably the "closure table model". More info on the different options for hierarchical data models can be found at: Models for hierarchical data.


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010096]
[Corion]: DST does that to everybody...
Corion attempts to find who to address to better target his drive-by patches
[Corion]: This time it's for the Duktape embedded Javascript engine, which would be nice to have IMO, but doesn't compile on Windows currently
[Corion]: I imagine it would be fun to have WWW::Mechanize:: Duktape, but I haven't seen a web browser written in Javascript yet, except the ones distributed with PhantomJs

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-03-27 11:07 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (319 votes). Check out past polls.