我在谷歌上搜索过但没找到正确的答案...... 我正在使用访问数据库在VB.net中计算发票 我必须在本月之前和之后获得所有记录 喜欢日期< = 2月,2014我不想要日期选项......
我有两张桌子
客户表
+--------+---------+
| refno | deposit |
+--------+---------+
| 1/13 | -10 |
| 10/13 | 500 |
| 100/13 | 0 |
| 101/13 | 250 |
| 102/13 | 1000 |
+--------+---------+
Ledger Table
+--------+----------+------+----------+
| 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总计直到所选月份日期< = Feb,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 :(得分: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