Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: mysql DBI Nested Queries

by Anonymous Monk
on Dec 24, 2012 at 15:53 UTC ( #1010205=note: print w/replies, xml ) Need Help??

in reply to mysql DBI Nested Queries

A simplified iterative approach, provided in pseudocode. Assumes supervisor is empty or null when hits CEO level. (Adjust while condition if not a good assumption.)

my $supervisor = $initial_employee_id; while ($supervisor) ( $row = select columns where eid = $supervisor; print out spreadsheet row for employee; $supervisor = $row{supervisor}; }

Also, since the database only returns a single row, you should be able to use the selectrow_arrayref function to make your sql code a bit simpler. And as for your "how to use variable inside sql string" question, see 7548

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010205]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-03-18 19:55 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (230 votes). Check out past polls.