简体   繁体   English

如果前一行值大于当前行值,则为MySQL

[英]MySQL if previous row value is greater than current row value

I have a table with 2 columns: date (date) and value(int). 我有一个包含2列的表格:日期(日期)和值(整数)。 How can I write a query to output the date and either 'Up', 'Down', or 'Same' by comparing the previous date's value to the current date's value. 如何通过将前一个日期的值与当前日期的值进行比较来编写查询以输出日期以及“上”,“下”或“相同”的查询。 (eg if 12/01/2016 has a value of 100 and 12/02/2016 has a value of 200 then the output should be 12/02/2016 Up. (例如,如果12/01/2016的值为100,而12/02/2016的值为200,则输出应为12/02/2016 Up。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM