<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>string concatenate &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/string-concatenate/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sat, 03 Sep 2016 07:48:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>PostgreSQL: STRING_AGG() to Concatenate String Per Each Group (Like SQL Server STUFF())</title>
		<link>https://www.dbrnd.com/2016/09/postgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function/</link>
					<comments>https://www.dbrnd.com/2016/09/postgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 02 Sep 2016 07:47:41 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[aggregation]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string concatenate]]></category>
		<category><![CDATA[string_agg]]></category>
		<category><![CDATA[stuff]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3569</guid>

					<description><![CDATA[Last week on my Facebook Page, I have received a couple message about what is a similar solution of SQL Server STUFF () in PostgreSQL. Most of the Database Developers require to perform String Aggregation based on different group of records. Since PostgreSQL 9.0, STRING_AGG(expression, delimiter) function is available to perform String Aggregation operation. Using [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function%2F&amp;linkname=PostgreSQL%3A%20STRING_AGG%28%29%20to%20Concatenate%20String%20Per%20Each%20Group%20%28Like%20SQL%20Server%20STUFF%28%29%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function%2F&amp;linkname=PostgreSQL%3A%20STRING_AGG%28%29%20to%20Concatenate%20String%20Per%20Each%20Group%20%28Like%20SQL%20Server%20STUFF%28%29%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function%2F&amp;linkname=PostgreSQL%3A%20STRING_AGG%28%29%20to%20Concatenate%20String%20Per%20Each%20Group%20%28Like%20SQL%20Server%20STUFF%28%29%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function%2F&amp;linkname=PostgreSQL%3A%20STRING_AGG%28%29%20to%20Concatenate%20String%20Per%20Each%20Group%20%28Like%20SQL%20Server%20STUFF%28%29%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function%2F&amp;linkname=PostgreSQL%3A%20STRING_AGG%28%29%20to%20Concatenate%20String%20Per%20Each%20Group%20%28Like%20SQL%20Server%20STUFF%28%29%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function%2F&amp;linkname=PostgreSQL%3A%20STRING_AGG%28%29%20to%20Concatenate%20String%20Per%20Each%20Group%20%28Like%20SQL%20Server%20STUFF%28%29%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fpostgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function%2F&#038;title=PostgreSQL%3A%20STRING_AGG%28%29%20to%20Concatenate%20String%20Per%20Each%20Group%20%28Like%20SQL%20Server%20STUFF%28%29%29" data-a2a-url="https://www.dbrnd.com/2016/09/postgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function/" data-a2a-title="PostgreSQL: STRING_AGG() to Concatenate String Per Each Group (Like SQL Server STUFF())"></a></p><p>Last week on my Facebook Page, I have received a couple message about what is a similar solution of SQL Server STUFF () in PostgreSQL. </p>
<p>Most of the Database Developers require to perform String Aggregation based on different group of records. </p>
<blockquote><p>Since PostgreSQL 9.0, STRING_AGG(expression, delimiter) function is available to perform String Aggregation operation.<br />
Using STRING_AGG(), We can concatenate strings using different type of delimiter symbols. </p></blockquote>
<p><strong>Example of STRING_AGG():</strong></p>
<p><strong>Create a sample Students table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students
(
	StudID INT 
	,StudName CHARACTER VARYING
	,StudGrades CHAR(1)
);</pre> </p>
<p><strong>Insert few sample records:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_Students 
VALUES 
(1,'Anvesh','A'),(2,'Kimly','B')
,(3,'Jenny','C'),(4,'Ali','B')
,(5,'Mukesh','D'),(6,'Sofia','A')
,(7,'Roy','C'),(8,'Martin','C');</pre> </p>
<p><strong>Concatenate Students Name per each Student Grade and arrange by Grade wise row (Using STRING_AGG()):</strong></p>
<pre class="crayon-plain-tag">SELECT 	
	StudGrades
	,STRING_AGG(StudName,', ') AS StudPerGrade
FROM tbl_Students
GROUP BY StudGrades
ORDER BY 1 ;</pre> </p>
<p><strong>The Result:</strong></p>
<pre class="crayon-plain-tag">studgrades |    studpergrade
------------+--------------------
 A          | Anvesh, Sofia
 B          | Kimly, Ali
 C          | Jenny, Roy, Martin
 D          | Mukesh
(4 rows)</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/09/postgresql-string_agg-to-concatenate-string-per-each-group-like-sql-server-stuff-string-aggregation-function/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
