I need make one custom report in SQL Server. I have one table called ProductsTable, in this table have the products tables of prices.
| id | description |
| 1 | TABLE A |
| 2 | TABLE B |
| 3 | TABLE C |
| 4 | TABLE D |
Now, i have the table ProductsTablePrices with all products prices and his tables.
| id | idproduct | idtable | price |
| 1 | 1 | 1 | 1.00 |
| 1 | 1 | 2 | 1.50 |
| 1 | 1 | 3 | 2.00 |
| 1 | 1 | 4 | 5.00 |
And finally, i have the Products table.
| id | name |
| 1 | Paper |
I need create one select to get one result like this…
| name | TABLE A | TABLE B | TABLE C | TABLE D |
| Paper | 1.00 | 1.50 | 2.00 | 5.00 |
Thanks!
I Use that to resolve my problem.
I don’t know if is a good practice, but works great and performance as well.
Thanks!