Friday, 15 May 2015

MySql select records between ranges -



MySql select records between ranges -

i've defined next table follows.

categories (id, start, end, price)

and values are

id start end cost 1 2 4 1000 2 5 10 3000 3 11 30 5000

if i'm having value 3 , should select 1st row.

the query should following

3 >= start , 3 <= end

but can't able select records here , i've tried follows.

select * table 3 >= start , 3 <= end;

please suggest me solution work appreciated.

this statement solve problem:

select * table 3 between start , end;

mysql range between

No comments:

Post a Comment