Produce DISTINCT values in STRING_AGG. Prior to SQL Server 2017, if you wanted to put your result into a comma separated . Most of the Database Developers require to perform String Aggregation based on different group of records. Its just that in SQL Server, it was available from 2017 version and on wards where as in Postgres it was available from version 9.0 (released in year 2010). The above function accepts two arguments and an optional ORDER BY clause.. expression is any valid expression that can resolve to a character string. Like other databases, PostgreSQL also has many string aggregation expressions and functions with order_by_clause and filter_clause.For string aggregation like Oracle LISTAGG, there are two functions, STRING_AGG and ARRAY_AGG.These don't cover all the functionalities in Oracle LISTAGG, but do offer the fundamental functionality of string aggregation. you have to use listagg for reshift . Code language: CSS (css) The STRING_AGG() function accepts two arguments and an optional ORDER BY clause.. expression is any valid expression that can resolve to a character string. --Step 03: Using STRING_AGG to generate comma-separated strings SELECT STRING_AGG(tbl.Name, '-*-') AS [CustomSeparatorString] FROM @NamesTable AS tbl; GO /RESULTS** CustomSeparatorString A--D--C--E--H--G / A minor challenge. As it says on the tin (well in the online documentation actually) "STRING_AGG is an aggregate function that takes all expressions. input_string is the character string to be processed. SQL | LISTAGG - GeeksforGeeks If such an ordering criteria is not provided, the concatenated string would be arbitrary in nature. SQL Server v.Next : STRING_AGG() performance - SQLPerformance.com SQL Server STRING_AGG() Function By Practical Examples here is alternative I created . PostgreSQL - STRING_AGG() Function - GeeksforGeeks However, the simplest way to do it is to use XMLAGG. Paul's Posts →. (These are separated out merely to avoid cluttering the listing of more-commonly-used aggregates.) One for units, one for jobs. How to workaround Oracle LISTAGG function in PostgreSQL From SQL Aggregate Functions (Office 2007) there are only these GROUP BY aggregate functions in Access SQL:. Produce DISTINCT values in STRING_AGG - NewbeDEV SQL STRING_AGG in Excel | MrExcel Message Board The String_agg solution is much simpler, but is only available on SQL Server 2017 currently. The function xmlparse takes xml as text and . SQL72014: .Net SqlClient Data Provider: Msg 195, Level 15, State 10, Procedure uspStoredProc1, Line 6 'STRING_AGG' is not a recognized built-in function name. SELECT deviceID, UserID, STUFF((SELECT activityName + ' - ' + CONVERT(varchar, createdDate) FROM tbl_DailyLogMaster WHERE userID = tbl_DailyLogMaster.UserID AND CONVERT(date . If you use other types than character string type, you need to explicitly cast these values of that type to the character string type.