现在我想实现
if
A1=(B1 or C1) then 结果1
else if
A2=(B2 or C2) then 结果2
请问这要在PG的语法中如何实现呀
在PG中,可以使用CASE WHEN THEN ELSE END语句来实现if else if语句,例如:
SELECT CASE
WHEN condition1 THEN result1
WHEN condition2 THEN result2
ELSE result3
END
FROM table_name;
写一个函数 然后在sql语句中调用写好的函数,函数中可以使用if else then参考:
https://www.coder.work/article/1670895
或者自己再找找文章