user1734190
user1734190

Reputation: 167

sql query is not working in case of number is in decimal

I am using the following query, it is showing the empty result but the record exist in table. Please let me know how can do it

select * from wp_rg_lead_detail where lead_id=5047 and field_number=1.6
select * from wp_rg_lead_detail where lead_id=5047 and field_number=1.6

in both case query return the empty result.but data exist in table.

data type of the field_number is float in database.

Upvotes: 0

Views: 661

Answers (1)

Mihai
Mihai

Reputation: 26784

Change the column to to decimal or numeric,they store exact numeric data values.Floats are always approximative numbers(in the way that are stored)

EDIT:Try it like this

select * from wp_rg_lead_detail where lead_id=5047 and format(field_number,1)=1.6

Upvotes: 1

Related Questions