I want to compare some floating values . To do,my query is like :
SELECT * FROM pricelist WHERE START_FREQUENCY >= '(
SELECT START_FREQUENCY
FROM pricelist
WHERE START_FREQUENCY BETWEEN '0.49999' AND '0.50001'
)' AND STOP_FREQUENCY <= '(
SELECT STOP_FREQUENCY
FROM pricelist
WHERE STOP_FREQUENCY BETWEEN '0.59999' AND '0.60001'
)'
But in my PHP it is showing ‘Unable to execute query’ . Where I am doing wrong ? Please help
EDIT :
I have a table where there is two fields ,START_FREQUENCY and STOP_FREQUENCY . I am trying to extract the all the values with that comes within frequency range . For example say
START_FREQUENCY STOP_FREQUENCY
1 0.4 0.9
2 0.5 1.4
3 0.8 1.9
When the user enter start frequency = 0.4 and stop frequency = 1.9 he should get results of Row1, Row2 and Row3.
Your inner SELECTs shouldn’t be quoted. Try this:
I also removed the quotes around your numbers; MySQL will convert them to numbers behind your back but there’s no need to make the database guess and do more work.
Your version has this structure:
And
'string'0.49999'isn’t valid.Update: Sounds like you’re just overcomplicating this. I think you just want this (using your 0.4 and 1.9):