@driano
(usa Ubuntu)
Enviado em 06/04/2015 - 10:07h
Como faço para saber a variação de preço dos produtos com base na data de Alteração?
Pensei em utilizar a data da alteração, porém tenho dúvidas.
SELECT id_produto,preco,data_alteracao FROM produtos_precos
ORDER BY id_produto
Resultado da pesquisa:
1;R$ 5,40;"2014-04-12 00:00:00"
1;R$ 4,95;"2015-01-02 00:00:00"
1;R$ 4,23;"2015-01-05 00:00:00"
1;R$ 3,10;"2015-02-15 00:00:00"
2;R$ 8,20;"2014-12-22 00:00:00"
2;R$ 7,60;"2014-08-12 00:00:00"
2;R$ 7,50;"2015-01-01 00:00:00"
3;R$ 4,21;"2015-01-11 00:00:00"
3;R$ 3,90;"2014-08-13 00:00:00"
3;R$ 3,50;"2015-02-04 00:00:00"
4;R$ 2,50;"2014-12-12 00:00:00"
4;R$ 1,99;"2014-07-10 00:00:00"
5;R$ 3,25;"2014-07-11 00:00:00"
5;R$ 3,00;"2014-12-01 00:00:00"
6;R$ 1,20;"2014-05-13 00:00:00"
6;R$ 0,99;"2015-02-03 00:00:00"
6;R$ 1,99;"2015-02-04 00:00:00"
6;R$ 1,50;"2015-01-03 00:00:00"
7;R$ 7,00;"2014-06-12 00:00:00"
7;R$ 9,50;"2014-12-28 00:00:00"
7;R$ 7,30;"2015-01-12 00:00:00"
8;R$ 32,00;"2014-12-28 00:00:00"
8;R$ 23,00;"2014-10-10 00:00:00"
8;R$ 27,56;"2015-01-15 00:00:00"
9;R$ 6,30;"2015-01-15 00:00:00"
9;R$ 4,50;"2014-11-23 00:00:00"
9;R$ 4,20;"2015-01-01 00:00:00"
10;R$ 11,45;"2014-11-21 00:00:00"
11;R$ 4,99;"2015-01-15 00:00:00"
11;R$ 5,40;"2014-11-15 00:00:00"
11;R$ 6,70;"2014-11-11 00:00:00"
12;R$ 3,50;"2014-11-23 00:00:00"
13;R$ 2,30;"2014-03-12 00:00:00"
13;R$ 2,50;"2015-03-01 00:00:00"
14;R$ 6,70;"2014-02-18 00:00:00"
15;R$ 2,50;"2014-10-03 00:00:00"
15;R$ 2,95;"2014-09-21 00:00:00"
15;R$ 3,00;"2014-10-01 00:00:00"