I use Visual Basic 2008 with Mysql
I have a table article with the following data :

Articlenb - Productcode - amount
1 - XXL - 1
2 - 12 - 1
3 - 10 - 1
4 - 1.5 - 1
5 - 7 - 1
6 - 4 - 1
7 - 1 - 1
8 - 1.5 - 1
9 - 7 - 1
10 - 4 - 1
11 - 1.5 - 1

To get this list below a have use this query :

Select articlenb , productcode, sum(amount) from article group by productcode

But i want to sort the list by productcode like this and i must use group by!!!


Articlenb - Productcode - amount
7 - 1 - 1
4 - 1.5 - 3
6 - 4 - 2
5 - 7 - 2
3 - 10 - 1
2 - 12 - 1
1 - XXL - 1

How can i achieve this?

Thanks,

André

Select articlenb , productcode, sum(amount) from article group by productcode order by productcode
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.