Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems with PL/SQL Distinct Expression

kings_landingMay 4 2016 — edited May 5 2016

Hello good day,

I have a problem with PL / SQL query, I want to make a select distinct to a column of a table, but I want other columns associated with the column to which I made the select distinct also appear, the query I have now is the next:

SELECT (SELECT DISTINCT FROM table1 T1.CAMPO1 T1), T1.CAMPO2, T1.CAMPO3, T1.CAMPO4, T1.CAMPO5, T1.CAMPO6 TABLE FROM T1;

I also tried to put a GROUP BY T1.CAMPO1 and I get the following error:

ORA-01427: single-row subquery returns more than one row

The summary of this is I make a select like this:

SELECT DISTINCT COL3 FROM TABLE1;

But the problem came when the select only returned the col3 column, and I wanted return all columns.

For this case I made this seleccionar:

SELECT (SELECT DISTINCT WL.BSSID FROM WLAN_SCAN_RESULTS WL), WL.ID_TC_SAM, WL.ESSID, WL.CHANNEL, WL.SECURITY, WL.WPS FROM WLAN_SCAN_RESULTS WL;

But neither give me the solutions that I wanted.

Thank you very much for your time.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 2 2016
Added on May 4 2016
20 comments
1,108 views