2014-03-02 59 views
0

之前,我已经搜索在谷歌但没有找到正确的答案... 我使用Access数据库 在VB.net计算发票我得一切记录前,从这个月年 如日期< =二月2014我不想在这一天选择...MSACCESS我想要得到计算所有记录的特定月份和年份

我有两个表

Customer表

+--------+---------+ 
| refno | deposit | 
+--------+---------+ 
| 1/13 |  -10 | 
| 10/13 |  500 | 
| 100/13 |  0 | 
| 101/13 |  250 | 
| 102/13 | 1000 | 
+--------+---------+ 

总帐表

+--------+----------+------+----------+ 
| refno | quantity | rate | recieved | 
+--------+----------+------+----------+ 
| 1/13 |  2 | 70 |  0 | 
| 10/13 |  3 | 80 |  0 | 
| 100/13 |  0 | 0 |  500 | 
| 101/13 |  4 | 60 |  0 | 
| 102/13 |  10 | 65 |  0 | 
+--------+----------+------+----------+ 

我想客户(存款)在总账中添加 我用这个查询

"select (sum(l.quantity*l.rate-l.recieved)+first(c.openbal)) as total from customer c RIGHT JOIN ledger l ON l.refno = c.refno having l.refno='" & LV_cinfo.Items(i).Text & "'" 

现在我想计算thios总高达选定的月份日期(总)< =二月2014

refno | total = customer.deposit+(ledger.quantity*ledger.rate-ledger.received) 
1/13 | -200 
10/13 | 4210 
100/13| 625 
101/13| 280 
102/13| 1000 

问候,

+0

对你的问题的描述很差。尝试更精确。你的桌子的名字是什么?涉及的列名是什么(金额,日期等),更重要的是,到目前为止您尝试过了什么? – Steve

+0

@Steve我编辑了问题解答,您会理解 – Naqi

+0

以上信息均不显示任何日期。你如何区分每个月销售的物品? – Mych

回答

0

试试这个

SELECT COUNT(<Column Name>) FROM <Table Name> WHERE (Date Between #<From Date># AND #<Till Date># 

Column Name : Primary Key Column Name 
Table Name : Data Table Name 
From Date : Starting Date 
Till Date : Ending Date 
相关问题