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!

Returning one distinct row per record (not two rows)

markjohn78May 25 2018 — edited May 25 2018

Tables/Indexes

I am simply querying to return the available rows of an Account Number on one SQL table called ‘QA_Table’ which has 9 fields only as below.

Sample output Data

Acc_No Cust_No   Prem_No       Name   Street   Street2   State  QA_Check   Source_File
3467      20867       189754            John     Main     Green        CA      Yes                Sheet_1
3467      20867       189754            John     Main     Green        CA      Yes                Sheet_1

Expected output Data

Acc_No Cust_No   Prem_No       Name   Street   Street2   State   QA_Check Source_File
3467      20867       189754            John     Main      Green       CA       Yes             Sheet_1

Explain the Actual Issue

When I run the following code, 2 identical rows are returned for this account number 3467 as output above.

I only want one row returned for this account number 3467, as expected above. Only one row should return, as there is only one row for this Account in my QA_Table.

This is the Select query code I am running, where the 2 rows return:

SELECT Acc_No, Cust_No, Prem_No, Name, Street, Street2, State, QA_Check, Source_File

FROM QA_Table

WHERE Acc_No = 3467;

I even tried a Distinct around some fields in my query, but to no avail.

Any ideas?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 22 2018
Added on May 25 2018
8 comments
1,938 views