title: How to limit the value resulting from string_agg in PostgreSQL into 3 values only?
body: <p><a href="https://i.stack.imgur.com/3DSB2.png" rel="nofollow noreferrer">enter image description here</a>I want to capture only the 3 productscodes from string_agg since My purpose is to see the any three products which are purchased together.</p>
  <pre><code>SELECT DISTINCT &quot;ORDERNUMBER&quot;, string_agg( &quot;PRODUCTCODE&quot;,',') AS Pro_purchased_together
  FROM &quot;Sales_data&quot;
  WHERE &quot;STATUS&quot;::varchar= 'Shipped'
  GROUP BY &quot;ORDERNUMBER&quot;
  ORDER BY 2 DESC
  </code></pre>