# Thread: Return results within certain percentage

1. ## Return results within certain percentage

Hi guys

I am pulling rows from my database

PHP Code:
``` SELECT PriceFROM Products WHERE  ```

What I need to do is pull all the products within 25&#37; of the 'Price'

So if Price is 1000 then 25% is 250

So the database will return all results from 750 to 1250

2. Originally Posted by wazo
Hi guys

I am pulling rows from my database

PHP Code:
``` SELECT PriceFROM Products WHERE  ```

What I need to do is pull all the products within 25&#37; of the 'Price'

So if Price is 1000 then 25% is 250

So the database will return all results from 750 to 1250

Calculate lower and upper limit in PHP (if you use PHP), and then put
Code:
`Price BETWEEN \$lowerlimit AND \$upperlimit`
in the WHERE statement of your query.

3. Code:
```SELECT Price
FROM Products
WHERE Price BETWEEN (1000 * (1-0.25)) AND (1000 * (1+0.25))```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•