Questions tagged [string-aggregation]

This tag is intended for SQL questions where multiple string (character) values should be aggregated into a single value using GROUP BY. The equivalent of sum() - just for strings.

The ISO/IEC SQL standard function for this is LISTAGG, but several DBMS:es have their own string aggregation functions:

386 questions
0
votes
1 answer

postgres sql 9.3 string_agg function not working on PHP

I have this set of tables: users table: id username 1 user groups table: id name 1 g1 2 g2 users_groups table: user_id group_id 1 1 1 2 and i want to obtain this result: id username …
yazfield
  • 1,233
  • 11
  • 18
0
votes
2 answers

Oracle Display the values of columns in single row without using connect by clause

This is my query select deptno,ename from emp_task; Output I want the output like this eno ename 20 TRINATH/RABHA 8 SAIKIRAN/KISHORE 10 KUMAR/VICKY/DAFNI
Prabha Christ
  • 131
  • 2
  • 2
  • 10
0
votes
1 answer

String aggregation in Oracle

I new to oracle SQL.I want to get the output like this deptno ename 10 A 20 b 30 c 10 d 10 e 30 f as deptno …
0
votes
1 answer

Advanced cursor for data selection in Oracle 10g

below mentioned code for cursor works only in Oracle 11g, as LISTAGG() function introduced starting version 11g. I need to adapt this code for Oracle 10g. Any help would be appreciated. SELECT DISTINCT (t3.field1), t3.field2, …
bofanda
  • 10,386
  • 8
  • 34
  • 57
0
votes
1 answer

Oracle SQL 10g query for creating comma separated records

I am writing an oracle 10g query for creating jasper reports. This is the query - SELECT essay_id, LTRIM ( MAX (SYS_CONNECT_BY_PATH (full_name, ',')) KEEP (DENSE_RANK LAST ORDER BY curr), …
Nikhil
  • 1,166
  • 2
  • 17
  • 35
0
votes
1 answer

Oracle SQL: rtrim and group by

I was doing like the following query and received "not a single-group group function" error. select distinct a.col1, a.col2, rtrim(xmlagg(xmlelement(e, b.col1 ||',')).extract('//text()'), ','), rtrim(xmlagg(xmlelement(e, b.col2…
Brooke
  • 435
  • 1
  • 5
  • 20
0
votes
3 answers

SQL aggregation of columns with common value in another column

I have an unresolved doubt about a query I'm making in PostgreSQL. I have these 2 tables PLAYER playerID title 1 Rondo 2 Allen 3 Pierce 4 Garnett 5 Perkins< PLAYS playerID …
Trink
  • 584
  • 3
  • 14
0
votes
6 answers

Get Count of different values in comma separated row in mysql

A table Jobs which have 2 column JobId, City when we save job a job location may be multiple city like below ----------------------------- JobId City ------------------------------- 1 New York 2 New…
Ashutosh SIngh
  • 931
  • 3
  • 13
  • 26
0
votes
1 answer

SELECT only Unique values from Multiple Columns in SQL

I have to concatenate around 35 Columns in a table into a single string. The data within a column can be repetitive with different case, as per the below. COL_1 apple | ORANGE | APPLE | Orange COL_2 GRAPE | grape | Grape The data in each column…
TechyHarry
  • 301
  • 2
  • 8
  • 25
0
votes
1 answer

Incredibly slow Materialized View creation when using string aggregation, any performance suggestions?

I've got a load of materialized views, some of them take just a few seconds to create and refresh, whereas others can take me up to 40 minutes to compile, if SQLDeveloper doesn't crash before that. I need to aggregate some strings in my query, and I…
Jimmy
  • 16,123
  • 39
  • 133
  • 213
0
votes
1 answer

Fetching value using LISTAGG but avoid grouping of a table used in Inner join

Hi I have an Oracle query like select listagg(name,',') within group (order by name) from table t1 inner join table t2 on t1.id=t2.id inner join table t3 on t1.value=t3.value but later i needed to fetch 2 more columns from another table t4 so i…
0
votes
2 answers

SQL - How To Combine Muliple Rows into a Single Result Set

Current Query - Select Item, Attribute, AttributeValue from table; Item Attribute Attributevalue 1 Color Brown 1 Width 24 1 Height 36 2 color white 2 …
0
votes
1 answer

How to group by a column and show as one row

I have a table with following structure SubId Status --------------------------------------- 001 Active 001 Partially Active While displaying this record, I need to display this like this SubId Status …
Microsoft DN
  • 9,706
  • 10
  • 51
  • 71
0
votes
1 answer

show data from multi column to single row

in my oracle database contained the following data http://i1207.photobucket.com/albums/bb476/daniwarrior/data-awal.jpg I want to display the data as shown below http://i1207.photobucket.com/albums/bb476/daniwarrior/data-aKHIR.jpg Whitelist column…
user1798945
  • 145
  • 1
  • 2
  • 7
0
votes
2 answers

Need help in grouping rows

Possible Duplicate: How can I combine multiple rows into a comma-delimited list in Oracle? I have a table that stores data in the following manner- 60333,120102,20120502,010000,1,2 60333,120102,20120502,020000,3,4…
redsoxlost
  • 1,215
  • 5
  • 19
  • 32