>Ok here's one for you guys, I want to split out from a table all records where a certain field's value occurs less than say 10 times in the said table.
>
>so say the field is custid and my table is orders, I could get out ALL the customers that have made less than 10 orders.
>
>The table is already in that field value order, so currently I scan through counting and checking if it changes, at that point and if my count is less than my limit I skip back and mark those records, reset the count and then continue the scan.
>
>this is not particularly fast or tidy yet I can't think of a better way, anyone?
>
>Ken.
What about:
select custid, count(*) as occurrences from orders group by custid having occurences < 10 into cursor c_orders
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges