我在PostgreSQL中有一個帶有3個字段的表:ebtyp,erdat,v_no。在PostgreSQL的Case語句中使用聚合和布爾值時遇到問題
輸入:
我想申請:(case when ebtyp='LA' and erdat=max(erdat) then vbeln end) as Inbound_delivery_number
我不希望過濾或使用LA/AB where子句,因爲我不想排除任何行。
輸出:
我試過,但它不工作:
select case
when ebtyp='LA' and erdat=max(erdat)
then v_no OVER (PARTITION BY ebtyp)
end as Inbound_delivery_number
from abc.table1;
我們可以使用與布爾函數聚合函數在一個case語句?任何解決方案?
http://meta.stackoverflow.com/questions/285551/why-may-i-not-upload-images-of-code-在那麼當灰化-A-問題/ 285557#285557 –