Hi,
I know sub select would not work correct in 3.23.xx but I have a question
to ask. I'd like to find top 10 ranking of my customer by amount (using
order clause desc) but there are some customer have the same amount. I was
solve this problem by using group by and insert it into temp table, then i
use select function join temp table with main table. Could someone tell me
the better way for this problem (i'd like to use only 1 sql statement)?
SF
example sql
1. insert into temp select *, count(*) from customer group by amount desc
limit 10
--> this sql generate only 10 row in temp table
2. select customer.* from customer, temp where customer.amount = temp.amount
--> this sql may be generate more than 10 row if there are many customer
who has the same amount
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php