Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Selecting only those records where there is only one row - Oraclw query

Posted on 2014-10-23
1
Medium Priority
?
371 Views
Last Modified: 2014-10-27
Experts,

I am reading a table in Oracle:
      Select   t1.CLAIM_NO
                              , t1.KICKOUT_CODE
                  , t1.cert_no
                   , t1.cost_center
                  , t1.arrv_date
       From Table1;

I would like to select only those records where there is only one row where t1.claim_no, t1.cert_no are the same.

Does anyone know how/if this can be coded as a single query?
0
Comment
Question by:morinia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 40399879
Try this:
      Select   CLAIM_NO
                   ,KICKOUT_CODE
                   ,cert_no
                   ,cost_center
                   ,arrv_date
from(
      Select   t1.CLAIM_NO
                   , t1.KICKOUT_CODE
                   , t1.cert_no
                    , t1.cost_center
                   , t1.arrv_date
                  , count(*) over(partition by claim_no, cert_no) mycount
        From Table1
)
where mycount=1;
0

Featured Post

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question