in reply to Whether to perl or oracle

Personally, I wouldn't put any of the binning logic in the SQL at all. In other words, retrieve the power levels unchanged from the database, then calculate the subtotals in Perl. You already have code in your Perl program to count the number of occurrences, except now it's much harder to see what's going on, because the logic behind the calculation is split between the Perl and the SQL (and is rather obscure in the SQL, IMHO).

It's hard to say whether you could improve the SQL without knowing more about the database design. My first impulse was to recommend joining wbr_power and hosts rather than using a subquery, but that may get you multiple rows if the hosts table is not unique on host_name. More information about the data model would help to tune up your SQL without introducing errors. ;-)

HTH

Replies are listed 'Best First'.
Re: Re: Whether to perl or oracle
by tradez (Pilgrim) on Feb 27, 2002 at 19:16 UTC
    Sorry about not giving more info on the particular normilization, I know what it is like to try and answer these obscure questions without all the info. It is infact unique on the host_name, but I think the subquery is a simple and efficient way of doing what I need. Thanks for the input though!

    Tradez
    "Never underestimate the predicability of stupidity"
    - Bullet Tooth Tony, Snatch (2001)