如何在下面的描述中解决这个问题。请我的软件也完成,但这个问题没有解决
问题描述:
我的系统出现问题。我的数据库上有一个名为Purchase的表。这是表格的图片。
I have a problem with my current system. I have a table named Purchase on my database. This is the picture of the table.
1/12/2016 25000
1/18/2016 5000
2/4/2016 5000
3/5/2016 6000
3/10/2016 5000
如你所见,我有与1月和3月相同的购买细节。但我希望结果集值如下:
As you can see, I have the same details of purchase for the month of Jan and March. But I wanted the resultsetvalue to be like this:
jan 30000 like
feb 5000 or
march 11000
请帮助我vb.net中的任何人
我尝试了什么:
i已经尝试在vb.net 2010和后端mysql,我的软件在线
Please help me anyone in vb.net
What I have tried:
i have try in vb.net 2010 and backend mysql and my software is online
答
使用GROUP BY和聚合SUM函数:
Use GROUP BY and the aggregate SUM function:
SELECT DATE_FORMAT(dateColumn, "%m-%Y") AS Month, SUM(ValueToAggregateColumn)
FROM MyTable
GROUP BY DATE_FORMAT(dateColumn, "%m-%Y")
>