in reply to Considerations on ordering
in thread Sorting

Thanks for that and I am actually using DB2 also.
I realise that when you do a simple select the order is maintained however I'm using a full outer join. So this orders the table fo me in the result. Even when I add an unsorted or order by clause it does not help. I really think that perl is my only option however if you can think of something within DB2 which would save me having top program it I would be delighted to hear about it.

j o h n i r l .

Sum day soon I'Il lern how 2 spelI (nad tYpe)

Replies are listed 'Best First'.
Re: Re: Considerations on ordering
by cebrown (Pilgrim) on Aug 13, 2002 at 13:21 UTC
    Ah! Well, I think if you're trying to do it in straight-up SQL with very little Perl, it'll be quite tricky. In order to get the order-preservation you need, I'm pretty sure you'd have to create a temporary table with the additional "counter" column I mentioned above (not sure how you would do this in DB2 but suspect there is a function to get that); also, with a temporary table you could update all NULL values to 0, sidestepping that problem as well. Since you're in DB2 you could automate the whole shebang with SPUFI. Or if you have QMF around you might be able to do everything within a FORM.

    But we're straying pretty far from Perl now and I really do think it'll be easier to dump the table into Perl's control and do all of your stuff there. It is the Practical Perfect Extraction and Reporting Language after all :). SQL is all well and good when you're working with more than one table but if you're trying to do fancy stuff within a result set it's almost always easier to program it.

      Yeah I've kinda come around to the realisation that I'm gonna have to program it. But any ideas how?

      j o h n i r l .

      Sum day soon I'Il lern how 2 spelI (nad tYpe)

        I would start with the other reply in this thread and go from there. I agree with the other poster that the requirements don't seem complete -- it might be worth posting a sample of the data from the database and hand-hacking a result of what you'd want that turned into. Right now we can only see an example of it not working.