Home > Back-end >  How do you write for an approximately equal to the SQL query?
How do you write for an approximately equal to the SQL query?

Time:02-25

Query is equal to about 50000, for example, all the records,

Assume that the database, 50001508, 00550, 00600, 00800 00

What I want is data between 49800 and 51000 within the data, how to write?

CodePudding user response:

Can't be with 49800-51000 as a condition, because 50000 is fixed

CodePudding user response:

Should make sure is approximately equal to the first condition is how much deviation range, and then query, assume that range is 200 ~ 1000, the query can be wrote:

Select * from tableName where (condition field - value) & gt;=- 200 and (condition field - value) & lt;=1000
  • Related