[Solved] Postgresql switch query to function


Just make it one:

create function ops()
  returns table (region varchar, man integer, woman integer, test integer)
as
$$
Select region,man, woman,
       Case 
         When woman > man then woman - man
         When woman < man then man - woman
        ELSE 0 
       END AS test
From people;
$$
language sql;

0

solved Postgresql switch query to function