M
mattia
Hi all, I have a table where for each product I have a list of
components; every component has a price an a date (usually different
prices per date).
I want to have a table where, for each product, I have the unique
components and the last saved price.
Example:
IDProduct | Component | Date | Price
----------+-----------+------------+-------
2 | 1 | 01/06/2008 | 12
3 | 2 | 07/12/2008 | 8
5 | 1 | 03/04/2009 | 5,5
6 | 3 | 01/05/2008 | 6
5 | 1 | 12/06/2009 | 11
2 | 1 | 21/08/2008 | 10
2 | 2 | 17/11/2008 | 7
3 | 2 | 05/09/2008 | 10
Result:
IDProduct | Component | Date | Price
----------+-----------+------------+-------
2 | 1 | 21/08/2008 | 10
2 | 2 | 17/11/2008 | 7
3 | 2 | 07/12/2008 | 8
6 | 3 | 01/05/2008 | 6
5 | 1 | 12/06/2009 | 11
Thanks, Mattia
components; every component has a price an a date (usually different
prices per date).
I want to have a table where, for each product, I have the unique
components and the last saved price.
Example:
IDProduct | Component | Date | Price
----------+-----------+------------+-------
2 | 1 | 01/06/2008 | 12
3 | 2 | 07/12/2008 | 8
5 | 1 | 03/04/2009 | 5,5
6 | 3 | 01/05/2008 | 6
5 | 1 | 12/06/2009 | 11
2 | 1 | 21/08/2008 | 10
2 | 2 | 17/11/2008 | 7
3 | 2 | 05/09/2008 | 10
Result:
IDProduct | Component | Date | Price
----------+-----------+------------+-------
2 | 1 | 21/08/2008 | 10
2 | 2 | 17/11/2008 | 7
3 | 2 | 07/12/2008 | 8
6 | 3 | 01/05/2008 | 6
5 | 1 | 12/06/2009 | 11
Thanks, Mattia