Home » SQL & PL/SQL » SQL & PL/SQL » Materialized View Query (Oracle SQL Developer 4.2.0)
|
|
|
Re: Materialized View Query [message #677080 is a reply to message #676890] |
Fri, 16 August 2019 06:22 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
CREATE TABLE TEST_TABLE
(
EMAIL VARCHAR2(50 BYTE),
FIRST_NAME VARCHAR2(50 BYTE),
LAST_NAME VARCHAR2(50 BYTE),
TEAM_PRODUCTS VARCHAR2(500 BYTE)
);
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('james.david@swimph.net', 'James', 'David', 'Goggles');
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('james.david@swimph.net', 'James', 'David', 'Fins');
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('james.david@swimph.net', 'James', 'David', 'Kickboard');
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('shiela.marie@swimph.net', 'Shiela', 'Marie', 'Goggles');
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('shiela.marie@swimph.net', 'Shiela', 'Marie', 'Kickboard');
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('kurt.john@swimph.net', 'Kurt', 'John', 'Goggles');
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('kurt.john@swimph.net', 'Kurt', 'John', 'Pullbouy');
Insert into TEST_TABLE
(EMAIL, FIRST_NAME, LAST_NAME, TEAM_PRODUCTS)
Values
('sherryl.anne@swimph.net', 'Sherryl', 'Anne', 'Goggles');
COMMIT;
SELECT Email,
First_name || ' ' || Last_name Name,
LISTAGG (Team_products, ', ') WITHIN GROUP (ORDER BY Team_products) AS Products
FROM Test_table
GROUP BY Email, First_name || ' ' || Last_name
ORDER BY Email;
|
|
|
Goto Forum:
Current Time: Sat Sep 07 19:51:15 CDT 2024
|