My Sql Relationship and Summarizing Datas
im using java / Mysql
ihave 4 table in my database - Products, FreeIssues, Invoice, FreeIssueQty

**Products**

x
y
z

**FreeIssues**

**FID       Product          Quantity**

I1           x                100
I2           y                100
I3           z                100

**FreeIssueQty**

**ID    FID       Product          Quantity**

1      I1          x                 10
2      I1          y                 05
3      I1          z                 05
4      I2          x                 02
5      I2          y                 02
6      I2          z                 02
7      I3          x                 04
8      I3          y                 04
9      I3          z                 04 

**InvoiceTable**

x-100
y-200
z-300

now what i need to do, free issue table contains some free issue quantity's, For Example if x will be invoiced 100/< then following free issues will be issued x-10, y-05, z-05 free issue Quantity's will be viewed in a separate column, can any one please tell me how to write a query for this function?
My Sql Relationship and Summarizing Datas
===

im using java / Mysql
ihave 4 table in my database - Products, FreeIssues, Invoice, FreeIssueQty

**Products**

x
y
z

**FreeIssues**

**FID       Product          Quantity**

I1           x                100
I2           y                100
I3           z                100

**FreeIssueQty**

**ID    FID       Product          Quantity**

1      I1          x                 10
2      I1          y                 05
3      I1          z                 05
4      I2          x                 02
5      I2          y                 02
6      I2          z                 02
7      I3          x                 04
8      I3          y                 04
9      I3          z                 04 

**InvoiceTable**

x-100
y-200
z-300

now what i need to do, free issue table contains some free issue quantity's, For Example if x will be invoiced 100/< then following free issues will be issued x-10, y-05, z-05 free issue Quantity's will be viewed in a separate column, can any one please tell me how to write a query for this function?