>>> I recently encountered a problem: >>> Why Window-specific functions do not allow DISTINCT to be used within the function argument list?
>>> sum( DISTINCT order_cost ) OVER ( PARTITION BY invoice_id ORDER BY invoice_id, group_id RANGE unbound preceeding and unbound following )
>>> behavior is quite deterministic:
>>> ORDER BY will create peers in partition >>> DISTINCT will get only one peer
>>> I resolve my problem via two subqueries, but it seems this logic may >>> be applied to window functions (did not check this for other functions thought)
>> Sorry, I do not follow. What problem did you encounter?