Click to See Complete Forum and Search --> : My SQL- Select Top 10 Spent


SAMM
04-09-2007, 03:39 AM
I have a database, there is over 1000 customer.
I have to sort top 10 spent customer.

my query is:

select distinct A.customer,sum(A.EC)
from table A
group by customer
order bycustomer
limit 10

this coding is cannot work. Pls advice.

raaam
04-09-2007, 05:02 AM
select customer,sum(A.EC) as total
from yourtable
group by customer
order by total desc
limit 10

SAMM
04-09-2007, 05:11 AM
YES. The problem was solved.
Appreciate your help.