Level 8
Apr 9, 2015
2
Level 1
Generate top three maximum transaction from the db
I have a transaction(id, quantity, rate, stock_code, user_code) table and I want to generate the top three transactions on the basis of their amount in descending order. Amount = quantity * rate
Is there a way to generate using only sql ?
Level 5
DB::select('SELECT quantity * rate AS amount FROM transaction ORDER BY amount DESC LIMIT 3');
1 like
Please or to participate in this conversation.