任何人都可以在postgresql中解释::含义吗?

时间:2015-01-12 13:30:00

标签: postgresql

我有下面的查询,它可以正常运行,但不知道postgresql中::的含义和用法。

select (
    select ( 
        case when 1 > 0 then 1::float / (
            select count(id) from transactions_products where transaction_id in (
            select id from transactions_transactions tt 
            where status = 3 and fi = 355 
                and (invoice_date >= 1420754400) 
                and (invoice_date <= 1421099999) 
                and (tt.division_id = 107) 
                and (tt.department_id = 210) 
        ) and is_vehicle = 1 
    )::float else 0 end)
 limit 1) as f_4

2 个答案:

答案 0 :(得分:7)

::是PostgreSQL的cast运算符。

答案 1 :(得分:0)

简短,没有麻烦的回答:它将值转换为浮动值。