我正在使用 VB6 和 MS Access 2013,我认为这很简单,但我现在坚持了 3 天。
我有两个表:
- Cheks:{ChekDate, Amount}
- 存款:{DepositDate, Amount}
我不知道如何得到这样的东西:
------Bank Statement------
01/01/15 300 Dep
01/01/15 100 Chk
02/02/15 400 Dep
03/02/15 150 Chk
有人有解决办法吗? 预先感谢您的宝贵时间。 吉尔伯托。
最佳答案
听起来您正在寻找union all
:
select *
from (
select checkdate, amount, 'Chk' as whichtable
from checks
union all
select checkdate, amount, 'Dep'
from deposits
) t
order by checkdate
关于sql - 如何使用查询或代码合并 2 个表的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33334721/