use where condition in string_agg postgresql code example Example: postgresql string_agg STRING_AGG ( expression, separator [order_by_clause] )