Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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]
[marto]: I can't even access client email, nor my employers since those idiots moved to citrix
[marto]: it literally doesn't work. Also, via their citrix interface theres no way to open attachments, or upload an attachment for sending. The company policy is that you email you work account from a personal one, and forward it on from there :/
[Corion]: marto: Ouch :/ And having that as a (written) policy strikes me as inane...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2018-01-16 08:55 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (175 votes). Check out past polls.