I have a SQLite simple table with 2 columns:
timestamp |last_price
1419873093|900.0
1419874283|900.0
1419940915|900.0
1419946324|916.58
1419946981|914.46
1419947981|800.0
I'd like to insert new values only if the price is different from last row price (I don't want consecutive prices to be the same). I can get the price from last row using:
SELECT last_price FROM BTC_BRL order by rowid desc limit 1;
Then I compare it with the new price, but if I could do this directly in the SQL statement, it would be better and faster.
I tried to use CASE WHEN, but without success.
Thanks!
Aucun commentaire:
Enregistrer un commentaire