我一直在寻找正确的方式 从两个不同的桌子上 抽取两排
我可以很容易地辨别出我想用这两个问题来总结的行数:
select *
from vui_trading_review_form_client
where month = 201202 and client_id= TOTALS ;
+--------+------------+-----------+-----------------+-----------------+-----------------+----------------+----------+
| month | dt_end | client_id | amt_balance_GBP | amt_balance_EUR | amt_balance_USD | dt_working_day | order_no |
+--------+------------+-----------+-----------------+-----------------+-----------------+----------------+----------+
| 201202 | 2012-02-29 | TOTALS | 2 | 3 | 4 | 2012-02-29 | 2 |
+--------+------------+-----------+-----------------+-----------------+-----------------+----------------+----------+
select *
from vui_trading_review_form_bank
where month = 201202 and provider= TOTALS ;
+--------+------------+----------+-----------------+-----------------+-----------------+----------+
| month | dt_end | provider | amt_balance_GBP | amt_balance_EUR | amt_balance_USD | order_no |
+--------+------------+----------+-----------------+-----------------+-----------------+----------+
| 201202 | 2012-02-29 | TOTALS | 1 | 1 | 1 | 3 |
+--------+------------+----------+-----------------+-----------------+-----------------+----------+
我想实现的,是一张如下的表格:
+-----------------+-----------------+-----------------+
| amt_balance_GBP | amt_balance_EUR | amt_balance_USD |
+-----------------+-----------------+-----------------+
| 1 | 2 | 3 |
+-----------------+-----------------+-----------------+
前3项总数减去后3项总数。
我尝试了加入 但我真的很难 得到正确的结果。
如有任何建议,将不胜感激。