find duplicates and include two copies... confused.

Hello Guru,
I'm trying to find phone numbers in doubles in a data base of phone. I have 2 tables (Agency, tphone_number).
I need to get the phone duplicate numbers names and agency 2 tables.
Agency: (agency_id, agency_name, County, State)
tphone_number:(agency_id,Phone_Number).

I need to find all duplicate phone numbers and include the agency_id, name of Agency, the County and the State of each duplicate for examination on good deletion or update.
I know that, to find a duplicate number I can:
SQL > select phone_number tphone_number where rowid > (select min (rowid) in the tphone_number b where b.phone_number = a.phone_number);

But how to create a list that includes all of the duplicate data and present agency_id, agency_name, phone_number, county, State of all duplicates, not only show the double single, but more the two organizations that share this phone number in double double.

It is curious of me, where the post.
Congratulations in advance.
with agency as(select 10 agency_id,'XYZ' agency_name,'XYZ' county,'MD' state from dual union all
select 20 ,'ABC' ,'ABC' county,'MD' state from dual union all
select 30 ,'ABC' ,'ABC' county,'MD' state from dual union all
select 40 ,'ABC' ,'ABC' county,'MD' state from dual union all
select 50 ,'ABC' ,'ABC' county,'MD' state from dual),
tphone_number as(select 10 agency_id,123 phone_number from dual union all
select 20,234  from dual union all
select 30 agency_id,123 phone_number from dual union all
select 40,234  from dual union all
select 50,999 from dual)

select s.*,t.phone_number
from agency s,tphone_number t
where s.agency_id=t.agency_id
and phone_number in
(
select t.phone_number
from tphone_number t
group by t.phone_number
having count(*)>1)

Tags: Database

Similar Questions

  • How to have two copies of the same program to install on WIndows 7 and on the desktop

    «"" "Dear help forum:»»"»

    I am new to WIndows 7, but just have not found the right research
    How to get my answer from Microsoft/Windows 7 basic knowledge.

    I have two programs. There are two versions of the same program
    ('LACE') One is the version 4.0.1, and the other is Version 4.0.6.

    I wish I had one old continue to run (using a purchased
    Product key which I own and have for years).

    BUT there is a problem. The old and new programs are the
    same 'setup.exe '? Download 124 MB each. There are small but
    many corrections and changes in the new program, I am told, but
    they do not have add up to change the size in MB of the program.

    SO I'm in trouble when I'm trying to download the program, as
    It seems to be in WIndows 7, a small program that removes the
    size of the incoming download and informed me that I can not download
    a new that I have already one of this program is installed in the
    computer!

    He asks me if I want to "Uninstall" the previous version and then replace
    It is with a new one. I can't cancel the old version because she had a
    Product key that was told to me in the instructions that he could
    only be used 'once', to uninstall the program won't help
    me as I won't be able to continue to use this program once again, as the
    registration code could only be used once.

    I have a purchased code new, different program version 4.0.6.

    Is this a problem with WIndows 7? I already called/sent the
    company and they have no help and no solution for how these two programs
    are to run on the same computer at the same time.

    Can you please help me and provide instructions on how I load
    This program of "LACE" most recent second size 124 MB and even download
    name in the computer (replacing the automated duplicate program
    prevention installer routine), so I can have and use two copies of
    This program on the computer at the same time?

    During the creation of this issue, I had an idea of what will happen if I created a
    second Downloaded Programs folder to contain the program setup.exe inside
    and try the operation or the opening of this place. He did not like
    the program checked the computer for the first copies of the
    LACE and identified, he was always present in the computer and asked
    Once again if I wanted to remove it.

    Thank you very much!

    If this program is not designed for the execution of the two copies on a single installation of Windows, then you simply can't do.  No ifs, ANDS or goals.  You have never been able to do with any version of Windows, and apparently the creators of this program thinks there is no reason to do so, then you'll just have to choose one version or another.  I'm not familiar with the lace, but more recent versions programs usually include most of the older features while adding the most recent.  They sometimes make us learn new ways of doing things that make us less happy, but I'm afraid that's life in the world of computing.

    That said, I must mention that there may be alternatives that you might continue even if they are less obvious than what you suggested.  If you have the professional version or full edition of Windows, you can get XP mode free you can start Windows 7.  It normally happens in 15 to 30 seconds and you could install and run another version of your program under that.  If you do not either of these versions, you can invest in the Anytime Upgrade and do it available.  Upgrade Home Premium to professional is $ 90.

    The other alternative would be a dual-boot configuration where you could have two versions of Windows in separate partitions, so when you start your computer, you can select the one with the version of your program you want.  I think that the choice of the XP mode would be preferable because it would be so much easier to use, but these two options are available, if you want to continue.

    Good luck.

  • I now have two copies of each song on my computer. An mp3 and a mp4. Which one should I keep?

    Original title: mp3 or mp4?

    I now have two copies of each song on my computer. An mp3 and a mp4. Which one should I keep?

    Hello

    Keep both until you can decide if you want only one. The compression ratio and other factors
    It will be different.

    Good Codec will allow you to play MP4 in Windows Media Player.

    Determine if 32 or 64 bits.

    Start - type in the search box-> Winver find upstairs and double click on - check version

    After that the foregoing, add codec - get these 32 bit if:

    -Free - CCCP also get free tool of insurgents
    http://CCCP-project.NET/
    http://www.freewaregenius.com/2007/02/09/CCCP-codec-pack/

    FFDSHOW - free
    http://sourceforge.NET/projects/ffdshow/

    Check here:

    Plug-ins for Windows Media Player
    http://www.Microsoft.com/windows/windowsmedia/player/plugins.aspx

    ============================================
    ============================================

    If 64-bit:

    Read this 1st and go that route, or use the one below.

    http://www.Vistax64.com/sound-audio/152850-Vista-codec-pack-32bit-64bit-Media-Player-codecs.html

    --------------------------------------------------------------------

    If 64-bit Vista - can run WMP in 32 or 64 bit mode.

    Or try these: download - SAVE - go to the place where your put them RIGHT CLICK – RUN AS ADMIN.

    For 32-bit use these - OR the 32 bit ones listed above which I prefer.

    K - Lite Codec Pack 6.2.0 (or newer)
    http://www.codecguide.com/

    Use them for 64-bit:

    K - Lite Codec Pack 3.7.0 (64-bit) (or newer)
    http://www.codecguide.com/

    -------------------------------------------------------------

    You know that you use WMP 32 or 64

    Change, change or set 64 - Bit Windows Media Player 11 (WMP11) in Windows Vista x 64 as default
    http://www.mydigitallife.info/2007/01/19/switch-change-or-set-64-bit-Windows-Media-Player-11-WMP11-in-Windows-Vista-x64-as-default/

    ------------------------------------------------------------

    VLC needs, of no use so usually Codec as a backup when asked to support associations of files just say no.

    VLC - free
    http://www.videolan.org/VLC/

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • Script to find duplicates in a row and combine the data in specific column

    Looking for a script to find duplicates in a line like below...

    "VM1', 'VM', 'LDEV', 'LDEV1', 'LDEV2', 'LDEV3', 'LDEV4', 'LDEV5', 'LDEV6 '.
    'VM', 'VI-SVC-VM001', "0000ef ', ' '," "," "," "," ""
    'VM', 'VI-SVC-VM001', "0000de ', ' '," "," "," "," ""
    'VM', 'VI-SVC-VM002', "0000df ', ' '," "," "," "," ""
    'VM', 'VI-SVC-VM002', "0000f0 ', ' '," "," "," "," ""

    .. .and manipulate the data in the following:

    "VM1', 'VM', 'LDEV', 'LDEV1', 'LDEV2', 'LDEV3', 'LDEV4', 'LDEV5', 'LDEV6 '.
    "" 'VM', 'VI-SVC-VM001', '0000ef', "0000de ', ' ', ' '," "," ""
    "" 'VM', 'VI-SVC-VM002', '0000df', "0000f0 ', ' ', ' '," "," ""

    (Note: VM VI-SVC-VM001 object has two LDEVs him assigned 0000ef and 0000de)

    There may be two, three, or n LDEVs attributed to each VM object. I guess I have to build a table and the "join-collections" script can't cut it on this one.

    I have the process to follow, I just need to put it in a loop (note, data already sorted on the virtual computer object):

    1 import-csv

    2. read each line, matched VM object, copy each found LDEV and place it in the next LDEV along

    3. remove the duplicate line

    4. rinse, repeat until the end

    Thank you.

    It's a solution pleasant Luc. I didn't use the Group-Object cmdlet to solve this problem.

    Now I can go to sleep without having to worry about this problem more.

  • Why make two copies of sent messages in the 'Sent' folder and I can change it to one?

    I automatically get two copies of every message I send in my "Sent" folder and I obviously wish I simply get a.

    Firefox send an e-mail, it's strictly a web browser.

    If you use Firefox to access your e-mail, you use "webmail". You must seek assistance from your service provider or a forum for this service.

    If your problem is with Mozilla Thunderbird, please Tag this thread as being for Thunderbird in the right column of this page. This issue is currently in the queue of Firefox to get answers.

  • Firefox open two copies of each time, one with my tabs and the other without, and if I close one, both close.

    Since a few days ago, whenever I open Firefox it opens two copies. Got my tabs from the previous session and the other only my home page. If I close is exemplary, the other closes as well. How can I get rid of the second copy?

    I am running version 27.0.1 in Windows 7 on a 64-bit operating system.

    Tried to delete the attributes read-only files that the above suggested. There is no additional file numbered as he said, there might be, however. Doesn't seem to help until I closed the second copy with the ability to close all tabs. This simple action closed just a single copy and left me with one that I still wanted to open. I closed and reopened, and always gave me one copy, so I guess it's all fixed.

    Thanks to those who tried to help!

  • My wife and I have laptops and we want to combine the data both on a Mac. Including two Itunes accounts. This is possible by using the migration on each PC asst?

    In what concerns the transfer of data from a PC to a MAC, my wife and I have laptops and we want to combine the data both on a Mac. Including two Itunes accounts. This is possible by using the migration on each PC asst?

    You can bind the whole apple ID using family sharing. If you have trouble doing this, you can go to the apple store, and they would be happy to help you.

  • Why do I receive two copies of emails recently? It started just two weeks previously and only for the main account.

    About two weeks ago we started all of a sudden received two copies of every email coming in on the main account only.  I spoke with Cox technical support and technical support of McAfee Security Suite with no response or correction.  Help

    Go to tools | Accounts. You have the same account entered twice?

  • You want to run the software RAID (more precisely 5) included with Windows Vista Home Premium. Do you know where I can find documentation and how - in?

    You want to run the software RAID (more precisely 5) included with Windows Vista Home Premium.  Do you know where I can find documentation and how - in?

    Hello

    Your question of Windows Vista is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public.
    Please post your question in the below link:
    http://social.technet.Microsoft.com/forums/en/IECs/threads

    I hope this helps.

    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I have a HARD disk with two partitions and two copies of Win7 but at the start, I have the black and white screen asking me only one to choose. How do I rename them.

    I have a HARD disk with two partitions and two copies of Win7 but at the start, I have the black and white screen asking me only one to choose. How can I rename the Windows 7 and Windows 7 Test to start in one I want right here?

    I have a HARD disk with two partitions and two copies of Win7 but at the start, I have the black and white screen asking me only one to choose. How can I rename the Windows 7 and Windows 7 Test to start in one I want right here?

    Use BCDEDIT to SET the description that you are wanting to "Rename" and also to choose the displayorder, timeout and that you load by default...

    Maybe this old conversation will help you:
     http://www.SevenForums.com/general-discussion/20191-renaming-earlier-version-Windows-dual-boot.html

  • Questions about the parameters of database using a fast recovery area and the writing of two copies of archived redo logs.

    My databases are 11.2.0.3.7 Enterprise Edition. My OS is AIX 7.1.

    I am to convert databases to use individual zones of rapid recovery and have two questions about what values to assign to database settings related to archived redo logs. This example refers to a database.

    I read that if I specify

    Log_archive_dest_1 =' LOCATION = USE_DB_RECOVERY_FILE_DEST'

    the names of newspapers archived redo written in the default quick recovery area is '% t_%S_%r.dbf '.

    In the past my archived redo logs have been appointed based on the parameter

    log_archive_format='GPAIDT_archive_log_%t_%s_%r.arc'

    I think log_archive_format will be ignored for logs archived redo written in the fast recovery area.

    I am planning to write a second copy of the archived redo logs based on the parameter

    ALTER system set log_archive_dest_2 = ' LOCATION = / t07/admin/GPAIDT/arch.

    If I do this, the copy of logs placed in /t07 will be called '% t_%S_%r.dbf' or 'GPAIDT_archive_log_%t_%s_%r.arc '?

    Before my use of a fast recovery area, I used the OEM 12 c Console to specify settings of backup of database that has been deleted and archived redo logs after 1 backup. Oracle manuals say rather specify a deletion of "none" policy and allow Oracle delete newspapers in the area of fast recovery if necessary. Since I got to keep a second copy of these log files in /t07 should I keep the policy that says to delete logs after 1 backup? If I don't do that, how will they removed from /t07?

    Thank you

    Bill

    If I do this, the copy of logs placed in /t07 will be called '% t_%S_%r.dbf' or 'GPAIDT_archive_log_%t_%s_%r.arc '?

    They will be "GPAIDT_archive_log_%t_%s_%r.arc". LOG_ARCHIVE_FORMAT is only ignored for directories under OMF.

    Since I got to keep a second copy of these log files in /t07 should I keep the policy that says to delete logs after 1 backup? If I don't do that, how will they removed from /t07?

    You can hold the deletion policy as it is. Oracle documentation, defining the STRATEGY of the ARCHIVELOG DELETION: "the deletion of archived newspaper policy applies to logs archive destinations, including the area of fast recovery."

  • can I use the cloud creative on my desktop and laptop, or what I have to buy two copies?

    can I use the cloud creative on my desktop and laptop, or what I have to buy two copies?

    Cloud license allows 2 activations http://www.adobe.com/legal/licenses-terms.html

    -Install on a 2nd computer http://forums.adobe.com/thread/1452292?tstart=0

    -Windows or Mac has no importance... 2 on the same operating system or 1 on each

    -Two activations on one account CAN NOT be used at the same time (to be noted in the link above of the license)

    -An individual account is for one person and may not be shared with anyone else

  • I can load a copy of Lightroom on my pc and my Mac?  Or do I have to buy two copies?

    I can load a copy of Lightroom on my pc and my Mac?  Or do I have to buy two copies?

    JackKessler01 wrote:

    I can load a copy of Lightroom on my pc and my Mac?

    Yes.

    A Lightroom license entitles you to two activations (Windows or Mac). So, you can activate on Win/Win, Mac/Mac or Win/Mac.

  • Find the difference between two date and time

    Hi friends,

    I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."

    select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed  
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate) 
    order by sql_step_num;

    You try to get the feel between two char strings.
    And more difference between two dates gives a NUMBER of days.
    Try this:

    select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate)
    order by sql_step_num;
    
  • I always have two copies of each email no matter where I pick up email - Outlook Express

    Double emails

    I use Outlook Express 6 for my work email.  I always get two copies of every email no matter where I pick up enamel - my computer at home, my work computer or my IPhone.  I can't understand why.  I don't have a problem with my hotmail address to any of these places.

    Maybe the following will help:

    Open Outlook Express 6 and go...
    Tools / Options / general tab...

    Try to uncheck...
    "When starting, go directly to my ' Inbox '.
    and / or...
    "Send and receive messages at startup".
    Apply / OK.

    You can find all you need on the following links:

    Microsoft.public.Windows.inetexplorer.ie6_outlookexpress
    http://groups.Google.com/group/Microsoft.public.Windows.inetexplorer.ie6_outlookexpress/search?q=1343+%2B+%22runtime+error%22+%2B+print&start=0&scoring=d&

    Duplicate Messages in Outlook Express
    http://groups.Google.com/group/Microsoft.public.Windows.inetexplorer.ie6_outlookexpress/browse_thread/thread/ed5d30177c9121f0/e3e758ed19579d09?q=duplicate&rnum=1#e3e758ed19579d09

Maybe you are looking for

  • XS708E super hot race and crashes after about 2-3 weeks of use

    Hi guys,. I installed the XS708E at home for my home enterntain system. I have reaised the switch may become hot after a while. The switch is installed in an open space where it is well ventilated. I realized that the perfomance of the switch slow do

  • Defective touchpad

    touchscreen only responds in the lower left corner of the touchpad

  • Find a new power supply for HPE-350 t

    Recently I upgraded my graphics card to a MSI GTX 570 Frozr III, he returned barely in there, and now I need to replace my power supply 300W so my computer would stop closing. I was very happy of the journal online CORSAIR TX650, but here is a proble

  • Printing with Hp laserjet P1102w wireless problems

    Hi, I have problems printing wireless on my macbook with Hello. I set up the printer and it prints ok. But after awhile, it loses comunitcation. I always turn off my router to reset everytime I need to print. I tried the printer of the assign a stati

  • Menus with several toggles (like the camera App)

    The application of BB10 camera has a unique menu that allows a few images switches in some of the menu items. (such as the flash mode you want). This kind of thing is possible in the third-party applications?  If so, how is this done?