Postgres how to implement calculated column with clause

前端 未结 2 592
温柔的废话
温柔的废话 2021-01-04 12:00

I need to filter by calculated column in postgres. It\'s easy with MySQL but how to implement with Postgres SQL ?

pseudocode:

select id, (cos(id) + c         


        
2条回答
  •  抹茶落季
    2021-01-04 12:56

    select id, (cos(id) + cos(id)) as op 
    from selfies 
    WHERE (cos(id) + cos(id)) > 1
    

    You should specify the calculation in the where clause as you can't use a alias.

提交回复
热议问题