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
Solved

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

Posted on 2014-10-23
1
356 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
1 Comment
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

861 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