问题描述
亲爱的,
我的桌子如:
InVoice表
======
ID int
日期日期时间
钱双倍
*案例A:
从InVoice选择ID,金钱
分组依据ID
ID = 1
=>结果是1行,ID = 1,Money = xxx(OK)
*案例B:
选择ID,Money
来自InVoice,日期
按ID分组,日期
ID = 1,日期介于'2013/11/1'和'2013/11 /之间10'
=>结果是很多行ID = 1和Money = xxx,yyy ......
我会在B情况下,结果显示1行,ID是1而Money是总计
请帮帮我
谢谢
Dear all,
I have table such as:
InVoice table
======
ID int
Date datetime
Money double
* Case A:
Select ID, Money
from InVoice
Group by ID
Having ID = 1
=> result is 1 row with ID = 1 and Money = xxx (OK)
* Case B:
Select ID, Money
from InVoice, Date
Group by ID, Date
Having ID = 1, Date between '2013/11/1' and '2013/11/10'
=> result is many row with ID = 1 and Money = xxx, yyy ...
I would in case B, result display 1 row, ID is 1 and Money is Total
Please help me
Thanks
推荐答案
这篇关于SQL命令 - 按命令分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!