1
我是Postgresql的新手。我想寫一個這樣的查詢:如何在postgresql中查詢SUM(IF(boolean,integer,integer))col_name
SELECT SUM(IF(id in(1,2,3,4,5,6),1,0)) spl_count from tab group by id;
但它不工作。它是給錯誤這樣的:
function if(boolean, integer, integer) does not exist
其實我已經嘗試過同類型的查詢我的意思是SUM(IF(布爾,整數,整數))在MySQL。它在那裏工作,但不在postgresql中。那麼我將如何在postgresql中編寫這種查詢呢?
是的,它工作。 – Joy