Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: how to find record data based on between in to two field in sql

Kelvin:

I have a table as product which have 2 fields price price_min and price_max.

I would like to find the product with 2 static value price like 200 as a price_min and 600 as price_max.

example :

product_1 has 100 price_min and 500 price_max its mean the product price is in 100-500 range, then i search for 300-400. The Product should be able to get.


product_id |price_min|price_max
-------------------------------
1 100 500
2 300 650
3 260 280
4 200 325
5 120 240

Case 1
Input values
************
price_min - 100

Expected Output
---------------
product_id 1,2,3,4,5


Case 2
Input Values
************
price_min - 210
price_max - 300

Expected Output
----------------
product_id 2,3,4

Case 3
Input Values
************
price_max - 400

Expected Output
----------------
product_id 1,2,3,4,5

I don't know how to logic the sql statement. Using beetween and where. Plese teel me



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: how to find record data based on between in to two field in sql

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×