Friday, 23 August 2013

How to select column in table by creating row in another table in MySQL

How to select column in table by creating row in another table in MySQL

I have three tables.
tax_master
item_master
item_tax
The values in it are like this.
*tax_master*
tax_id tax_name tax_value
--------------------------
1 Vat 5
2 LBT 8
*item_master*
item_id Prise
---------------
1 30
2 100
*item_tax*
item_tax_id item_id tax_id
------------------------------
1 1 1
2 2 2
3 1 2
Now i want output like this.
item_id VAT LBT
-------------------
1 1.5 2.4
2 - 8
VAT value is calculated like 5/30*100 like 5% on 30=1.5

No comments:

Post a Comment