mysql - Select based on numeric difference -


i have database table holds order information , saves current gold price (world price) automatically @ time of entry.

if on table, , saved gold price has difference current gold price of +100, o want show in report.

how write mysql query this? know how datediffs not numeric values.

example:

select * table saved_price < current_price - 100 

is there better way this?

use abs if sign of difference doesn't matter:

select * table abs(saved_price - current_price) > 100 

if sign interesting, suggested approach fine. i'd write this, use way think read- , understandable:

select * table (current_price - saved_price) >= 100 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -