SELECT distinct t4.value,t1.`date_created`, t5.value, t6.value
FROM `wp_rg_lead_detail` AS t0
JOIN wp_rg_lead AS t1 ON t1.`id` = t0.`lead_id`
JOIN wp_rg_lead_detail AS t2 ON t0.`lead_id`=t2.`lead_id`
JOIN wp_rg_lead_detail AS t3 ON t0.`lead_id`=t3.`lead_id`
JOIN wp_rg_lead_detail AS t4 ON t0.`lead_id`=t4.`lead_id`
JOIN wp_rg_lead_detail AS t5 ON t0.`lead_id`=t5.`lead_id`
JOIN wp_rg_lead_detail AS t6 ON t0.`lead_id`=t6.`lead_id`
WHERE t1.`date_created` > '2014-01-01'
AND (t2.field_number = 31 AND t2.value= "somevalue")
AND (t3.field_number = 111 and t3.value="yes")
AND (t4.field_number = 24)
AND (t5.field_number = 73)
AND (t6.field_number = 2.60)
AND t0.`form_id`=5
t6.fieldnummer字段值为FLOAT。 如何将查询中的2.60值转换为(转换为什么),因为它与数据库中的值匹配?我只用十进制值来解决这个问题。
答案 0 :(得分:1)
进行浮点数比较的正确方法是首先确定数字之间差异的可接受容差,然后与容差值进行比较。例如,如果我们同意如果浮点数在一万分之一(0.0001)的精度内相同时应该被视为相同,则应该进行比较以找出大于容差值的差异:
ABS(t6.field_number - 2.60) <= 0.0001