我有三张桌子
**Table A**
+-----------------+
| Name | ID |
+------------------
| A1 | 1 |
| A2 | 2 |
| A3 | 3 |
+------------------
**Table B**
+---------------------------------------+-----+-------+
| TimeStamp | Type| ID |
+---------------------------------------+-----+-------+
| 2013-05-10 08:10:10.161302-04 | B1 | 1 |
| 2013-05-10 09:20:10.171302-04 | B1 | 1 |
| 2013-05-12 08:10:10.161302-04 | B2 | 3 |
| 2013-05-13 08:10:10.161302-04 | B2 | 3 |
| 2013-05-14 08:10:10.161302-04 | B1 | 2 |
+---------------------------------------+------+------+
**Table C**
+---------------------------------------+-----+-------+
| TimeStamp | Type| ID |
+---------------------------------------+-----+-------+
| 2013-05-12 08:10:10.161302-04 | C1 | 1 |
| 2013-05-12 09:20:10.171302-04 | C2 | 2 |
| 2013-05-12 08:10:10.161302-04 | C1 | 2 |
| 2013-05-12 08:10:10.161302-04 | C3 | 1 |
| 2013-05-13 08:10:10.161302-04 | C1 | 2 |
| 2013-05-13 08:10:10.161302-04 | C3 | 3 |
| 2013-05-14 08:10:10.161302-04 | C1 | 1 |
+---------------------------------------+------+------+-
**Expected Result of Query**
+---------------------------------------+-----------------------------+
| Date | B.count(B1 entries) | C.count(c1 entries) |
+---------------------+-----------------------+-----------------------+
| 2013-05-10 | 2 | 0 |
| 2013-05-12 | 0 | 2 |
| 2013-05-13 | 0 | 1 |
| 2013-05-14 | 1 | 1 |
+---------------------+-----------------------+-----------------------+
- 表B和表C中的ID参考表A.ID
- 我正在寻找的查询是:每天计数表 B 中的 B1 条目数和表 C 中 ID {1,2} 的 C1 条目数
欢迎任何建议。