任何人都可以解释 :: 在 postgresql 中的含义吗?
Can anyone explain :: meaning in 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
简短、简单的答案:它将值转换为浮点数。
::
是 PostgreSQL 的 cast 运算符。
我有以下查询可以正常工作,但不知道 ::
在 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
简短、简单的答案:它将值转换为浮点数。
::
是 PostgreSQL 的 cast 运算符。