Subject | Is it possible to have a SELECT with a variable number of columns? |
---|---|
Author | W O |
Post date | 2013-11-17T02:59:37Z |
Hello everybody
I have an application where the tables are all normalized and so the taxes are not in the same table as the sales.
Sometimes a sale should to pay 1 tax, sometimes 2 taxes, sometimes 3 taxes, etc.
And it would be nice to have in just 1 row data of the sale and of the taxes, each tax in its own column:
DATE, INVOICE, AMOUNT, TAX1, TAX2, TAX3, ... TAXN
Table1
----------
ID_TABLE1
DATE
INVOICE
AMOUNT_SALE
Table 2
----------
ID_TABLE2
ID_TABLE1
ID_TAX
AMOUNT_TAX
Greetings.
Walter.