1

我有三张桌子

1) tax_master

-------------------------------
|  tax_id ||tax_name||tax_value|
--------------------------------
|   1     ||    VAT ||   5     |
--------------------------------
|   2     ||    LBT ||   8     |
-------------------------------

2) item_master

----------------------
|  item_id ||price   |
----------------------
|   1     ||   30    |
----------------------
|   2     ||   100   |
----------------------

3) item_tax

-----------------------------------
|  item_tax_id ||item_tax||item_id|
-----------------------------------
|   1          ||  1     ||   1   |
-----------------------------------
|   2          ||    2   ||   2   |
-----------------------------------
|   2          ||    2   ||   1   |
-----------------------------------

所以现在我想要这样的输出

----------------------------------
|  item_id ||  VAT   ||   LBT    |
----------------------------------
|   1      ||  1.5   ||   2.4    |
----------------------------------
|   2      ||   -    ||   1.6    |
----------------------------------

增值税的值计算为 5/100*30 为 5% on 30=1.5 所以想要这样的输出我很困惑。并尝试了很多但力不从心。你能帮帮我吗

4

0 回答 0