By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,435 Members | 2,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,435 IT Pros & Developers. It's quick & easy.

How to order with few criteria?

P: 11
Hello everybody, im newbie on mysql.
Now i want order by few criteria, that is stallName, date and productName.
I code with "select * from item order by stallName, date, productName", it generates result like this :
Chicken King
Sales on 13/03/2008
ITEM QTY TOTAL AMOUNT (RM)
chicken sweetie 1 2.49
Aloha Chicken 2 16.00
special chicken soup 1 3.99
Aloha Chicken 1 8.00
Ckicken Pao 2 4.50

Kari Mamak
Sales on 13/03/2008
ITEM QTY TOTAL AMOUNT (RM)
Sambal Ikan 11 33.00
Mee Goreng 3 12.00
Sambal Ikan 2 6.00
Kari Ayam 1 2.70
Sambal Ikan 6 18.00

But actually what i want is :
Chicken King
Sales on 13/03/2008
ITEM QTY TOTAL AMOUNT (RM)
chicken sweetie 1 2.49
Aloha Chicken 3 24.00
special chicken soup 1 3.99
Ckicken Pao 2 4.50

Kari Mamak
Sales on 13/03/2008
ITEM QTY TOTAL AMOUNT (RM)
Sambal Ikan 19 57.00
Mee Goreng 3 12.00
Kari Ayam 1 2.70

Your replies is appreciated.Thanks in advanced.
**The Bold text is Quantity, i hope it can help you all see better.
** another things need to mention is, my date is consists date and time.
Mar 21 '08 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127
Try using the order by clause in the order you want .
Mar 21 '08 #2

ronverdonk
Expert 2.5K+
P: 4,258
Show mth select your are using now (within approproiate code tags!!) and we can see where it must be adapted.

Ronald
Mar 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.