>Suppose a query on the sales table does result in 100 records.
>90% of the sales applies to only 10 customers (records) , the last 10% applies to 90 customers (records).
>Now I want to summarize this 90 records to only 1 record with the name "Others".
>
>- Is there a common name for this approach
>
>- What would be the best approach ? (does someone have samples for it)
>
>regards,
>
>Rinse
Select Top 10 sum(sales_amt) as tot_amount,cust_id From sales Into cursor tmp1 Group BY cust_id Order By 1 desc
Select tot_amount,cust_id From tmp1 ;
Union Select Sum(sales_amt) as tot_amount,'others' as cust_id From sales Where cust_id not in (Select cust_id From tmp1) Group by 2
Edward Pikman
Independent Consultant