My table looks like this:
When the WHERE
clause is equal to value with decimal point I get no valid output like:
SELECT transponder_id FROM signals.dvbs_transponders t WHERE t.freq = 11487.77
Output: transponder_id = None
When the query is for integer value, query works correctly:
SELECT transponder_id FROM signals.dvbs_transponders t WHERE t.freq = 11470
Output: transponder_id = 1009
Also using BETWEEN
query returns expected values
SELECT transponder_id FROM signals.dvbs_transponders t WHERE t.freq between 11487 and 11488
Output: transponder_id = 1010
Why is my query using ‘equal’ operator not working with decimal values? I don’t like the between
solution as it require to set tolerance range. How the query should be defined to work also with decimal values?
Advertisement
Answer
Put it under single quotes :
select * from dvbs_transponders where freq = '11487.77'