ID display which are repeated several times

Hello

I want to display the person ID who works is more than any defined countries ('INDIA', 'USA', 'US', "CHINA", "JAPAN")

for example, ID 1001 works in USA and India. so output should pick up this ID. But I get no output

can someone help me.

with t as

(

Select 1001 as ID, 'USA' as countries of all the double union

Select 1001 as ID, 'INDIA' as countries of all the double union

Select 1002 as ID, 'USA' as countries of all the double union

Select 1002 as ID, 'US' as countries of all the double union

Select 1003 as ID, 'ARGENTINA' as countries of all the double union

Select 1004 as ID, 'USSR' as countries of all the double union

Select 1005 as ID, 'INDIA' as countries of all the double union

Select 1006 as ID, 'TAIWAN' as countries of all the double union

Select 1009 as ID, 'CHINA' as countries of all the double union

Select 1009 as ID, 'BHUTAN' as countries of all the double union

Select 1006 as ID, 'JAPAN' as countries of the double

)

Select * from t

WHERE COUNTRIES ('INDIA', 'USA', 'US', "CHINA", "JAPAN")

Group by id, country

Having count (distinct id) > 1

Hello

Since you only want to see the identity card, then you must include the id in the SELECT and GROUPBY clauses.

SELECT id

T

Countries WHERE the ('INDIA', 'USA', 'US', "CHINA", "JAPAN")

GROUP BY id

After HAVING COUNT (DISTINCT country) > 1

;

If you are grouping BY id, then COUNT (DISTINCT id) will always be 1 (or 0).  We are not interested in how different IDS are in each group. We are interested in how many different countries in each group there.

The query above is considered 'USA' and 'WE' different countries.  Is that what you want?

If this isn't the case, you can map 'WE' to 'USA' (or vice versa) like this:

SELECT id

T

Countries WHERE the ('INDIA', 'USA', 'US', "CHINA", "JAPAN")

GROUP BY id

HAVING COUNT (DISTINCT CASE

Country WHEN = "en".

THEN "USA."

OTHER countries

END

) > 1

;

You did a great job, view the sample data!   Don't forget to post the exact results you want from these sample data.

Tags: Database

Similar Questions

  • A Recordset repeat several times

    I have a set of records that will always return 1 card with anywhere from 1 to 16 from tbl. Fields, which are where my problem begins. Because I can't use repeat region I need to get this recordset to be repeated several times according to the session variable (Session("Times").

    (< % Session("Times") = Session("Quantity") / Session("Fields") % >)

    My question is, is it possible to repeat this recordset, then it will be displayed on a page of equall to Session("Times")?


    Example: Could Session("Quantity") = 900 and could Session("Fields") = 3 then I would that this recordset repeated 300 times

    Another: Session("Quantity") pu = 500 and Session("Fields") could = 10 then I would that this recordset repeated 50 times

    The data returned (repeated) would have 3 fields displayed 300 times

    Or 10 fields display 50 times

    Thank you

    Just create a loop that runs through the Session("Times") several times.  Right?

  • Windows has repeatedly several times updated

    Windows has repeatedly several times updated KB2310138, KB2686827, KB2656405, KB265368, KB2604121, KB2656351 and still wants to update, use the hotfix from microsoft and he always does. Windows Vista.

    Hi Libby,

    I see that you are offered to install updates KB2310138, KB2686827, KB2656405, KB265368, KB2604121 and KB2656351 several times.

    You can follow all the methods listed in the article mentioned below to solve the problem:

    Troubleshooting Windows Update or Microsoft Update when you are repeatedly offered an update

    http://support.Microsoft.com/kb/910339

    Note: The article applies both to Windows Update in Windows Vista.

    It will be useful. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

  • My stored user names and passwords are removed several times each time the computer restarts. ______

    My "XP Home Edition' Service Pack 3 > stored user names and passwords are removed several times each time the computer restarts.

    Please check the LINK for the process that I'm going through, but nothing helped.

    http://www.box.NET/shared/zcokjesxx3

    Thank you for your kind cooperation.

    Sincerely,
    Frank

    Hi Ajay,

    It worked!

    Was the only thing that I changed, I added a % USERPROFILE % so he looked like that before

    %USERPROFILE%\Application data

    Instead of like this USERPROFILE%\Application Data

    Not sure if this was necessary to make - but again - it WORKED...

    Thank you very much for your time and your help is to solve this for me.

    Sincerely,

    Frank

  • How to make a text field repeat several times?

    I have created a form with the name of a client in it - and the name is repeated at the top of each page.  How to make a text field repeat several times? Thank you!

    Make sure that all fields have the same name (LastName FirstName, MiddleName,), then set the binding in the overall binding tab.

    Paul

  • Windows uppdates are offered several times

    Original title: Windows Vista updates - non-STOP

    These days my Windows Vista updates the same thing... ? I installed it for several times, and it was like this 3 consecutive days. After that I updated, he invites me to update the same thing again and it really gets me upset. So I spend a lot of time off my computer just to redo the same update. These are the things that are repeatedly asked to update despite fact. [Link TO IMAGE]

    Hello

    Updates in the issuance of the list shown in the screenshot are different updated.

    If the offered updates are always the same, I suggest to see the link below and follow the steps. Check if it helps.

    Windows Update or Microsoft Update repeatedly offers the same update

    http://support.Microsoft.com/kb/910339

    Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    322756 (http://support.microsoft.com/kb/322756/) how to back up and restore the registry in Windows

    http://support.Microsoft.com/kb/322756

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Let us know if it helps!

  • Why Windows Update again down the following updates updated for which I made several times your help would be so appreciated

    Hello

    Yes what is happening that I launch Windows update and get the following although I did several times also rebooted PC installation the following downloads Microsoft XML Core Services 4.0 Service Pack 2 (KB973688) and update of security for Microsoft XML Core Services 4.0 Service Pack 2 (KB954430) just keep asking for them again and again. Update icon is not far from the task bar please help muchly appreciated thanks.

    Hello

    • Did you change your computer before this problem?

    Method 1

    You can check if updates have been installed through the update history.

    See the Windows updates are installed

    http://Windows.Microsoft.com/en-us/Windows-Vista/see-which-Windows-updates-are-installed

    See Windows Update History for any error message.

    If the update is installed successfully, follow the next method.

    Method 2
    You can follow the steps in the article and see if it helps.
    Troubleshooting Windows Update or Microsoft Update when you are repeatedly offered an update
    http://support.Microsoft.com/kb/910339

  • Worm button 31 preferences is not visible, even though I repeated several times. How can I make visible?

    In 31 worm remote content option 'show' has been changed to a button "Preferences". This button does not appear on my Thunderbird. I made sure it is up-to-date. I rebooted several times, and yet I can't get the button to display.
    As a solution, I'll have to watch my mail through the browser - not always convenient.

    Thank you for your help.

    did you reboot in helkp with disabled modules menu. V31s changes can be flipped up an add-on and it hides the button.

  • "updates are offered several times when it is already installed"

    OP: Microsoft updates
    I just formatted my computer and reloaded win xp and it keeps the updates made, he did a lot of them until there now 4 updated who said that they are ready to be installed and I installed it several times but he returns constantly to the taskbar, saying the same updates are ready to install. I tried at least 10 times without success.

    kb979909

    kb982524

    kb982168

    kb983583

    Here's the update #'s.

    1. How to determine what version of the .NET Framework is installed and determine whether the service packs have been applied
      http://support.Microsoft.com/kb/318785
      This article explains how to determine what versions of Microsoft .NET Framework installed on your computer.

    2. When you try to install an update for .NET Framework 1.0, 1.1, 2.0, 3.0 or 3.5, you may receive Windows Update '0 x 643' error code or error code Windows install "1603".
      http://support.Microsoft.com/kb/923100

    TaurArian [MVP] 2005-2011 - Update Services

  • Some installed Windows updates are offered several times

    Original title: Windows XP service pack HELP

    Hi all
    I have windows xp
    IV been download and update my PC from the microsoft Web site, but in my taskbar it always shows the shield of the warning "DATES ARE READY FOR YOUR COMPUTER"... I continue to run and install the updates, but next time my PC restarts the same updates are available again
    every time I also run disk with CCleaner it allways watch cleanup these frameworks and components must be repaired.

    IV checked in my add and remove program what Microsoft programs are installed, here's the list...

    Microsoft, Net Framework 1.1
    Microsoft Net frame work 2.0 service pack 2
    Microsoft Net frame work 3.0 service pack 2
    Microsoft Net frame work 3.5 service pack 1
    Microsoft Net frame work 4 customer profile
    Microsoft Net Framework 4 expanded work

    Microsoft compression client pack 1.0 for windows xp
    Microsoft user-mode driver framework feature pack 1.0
    Microsoft visual c ++ 2005 redistributable-86 9,0,30729,17
    Microsoft visual c ++ 2008 redistributable-86 9,0,30729,4148

    Microsoft XML core services 4.0 service pack 2 (KB954430)
    Microsoft XML core services 4.0 service pack 2 (KB973688)

    all these are enough? what I did problem and how can I solve this

    Thank you

    Hi louisedefoe,
     
    This problem occurs when one of the following conditions is true:
    • An error occurred during the installation. The update has not been installed.
    • The update has been installed. However, a file was not updated to restart the computer.

    Follow the steps listed in the article given below to resolve this issue:

    Troubleshooting Windows Update or Microsoft Update when you are repeatedly offered an update

  • My mail deleted are reloaded several times now have 2100!

    Seem update. I now have several copies, 12-13, deleted messages so now 2100 deleted emails that have reloaded after deletion in the Delete box. Figure greatly increases whenever I try to delete them.

    Time for a bit of drastic measures.

    Make folders and hidden files visible;

    in Thunderbird

    • Help > troubleshooting information
    • Click on "view file".

    a new window opens to display the profile folder.

    • Close Thunderbird now - this is important
    • Click the folder "mail".
    • Click the name of the e-mail account folder
    • Search for files "Trash" and "Trash.msf". The trash will be probably quite a large file.
    • Delete these two files.

    Close window - top right X

    Restart Thunderbird.

  • Updates are offered several times to install.

    Original title: maintains.

    Hello

    Since a month every time I turn on my computer and go turn off there are a 3 windows 7 updates that must be installed. It doesn't matter how many times a day, that I turned on my computer, when I go to close it there are 3 updates. What gives? Can I have a virus?

    You receive errors related to updates?

    1. Open Windows Update by clicking the Start button, all programs and then click Windows Update.
    2. In the left pane, click view update history.
    3. Find an update for Windows that has failed to install, and then double-click the update to view more information.
      Updates that have failed to install will display failed under status, next to the name of update.
    4. In the Windows Update dialog box, next to the details of the error, review the error code for the update has failed.

    Follow the links in the Windows Update dialog box under more information or help and Support to resolve the problem, then try to reinstall updates by using Windows Update in Control Panel or by mail with the error code and maybe someone may be able to help others.

    Windows update General troubleshooting

    Suggestions:

    Make sure that the following services are started.

    1. Click Start, type services.msc, press on enter, and then click Services.

    Double-click on these "Windows Update Service", "Cryptographic Service" and Background Intelligent Transfer Service"and under the general tab, verify that the service has not been disabled in the Startup Type box. If the Service has been disabled, then set to automatic.

    1. Perform a clean boot to start Windows using a minimal set of drivers and startup programs. A clean boot helps eliminate software conflicts. Then try to install the update from the download file that the problem may occur because of a conflict of third party software.

    The following link has steps showing how to perform the clean boot:
    http://support.Microsoft.com/kb/929135

    The purpose of a clean boot is trying to find out what service/program is causing a problem.

    To help resolve the error and other messages, you can start Windows by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts. This article describes how to solve problems in Windows by performing a clean boot. This article also describes how to start the Windows Installer service and how to reset the computer so that it starts as usual.

    Note When you perform a clean boot, you may temporarily lose some functionality. When you start the computer as usual, the function returns. However, you may receive the error message, or you can experience the original behavior.

    Important - step 7: reset the computer to start as usual

    1. Download the update and install the update manually
      http://www.Microsoft.com/downloads/en/default.aspx

    TaurArian [MVP] 2005-2011 - Update Services

  • IMPOSSIBLE TO UPDATE ALL APS, CONTINUES TO RECEIVE YOUR COMPENSATION ACCOUNT PAL IS NO LONGER VALID, GO TO THE ITUNES STORE ETC., WHICH I DID SEVERAL TIMES GRRRRRRRRRR 50MINUTES W APPLE ADVISOR - IT HAS JUST FACT, BUT LOSE THE SETTINGS ETC. ??

    IMPOSSIBLE TO UPDATE ALL APS, CONTINUES TO RECEIVE YOUR PAY PAL ACCOUNT IS NO LONGER VALID, GO TO THE ITUNES STORE ETC, WHAT I'VE DONE SO MANY TIMES

    50MINUTES W APPLE ADVISOR - SHE HASN'T DONE, BUT LOSE SOME SETTINGS ETC. ??

    PayPal requires that a credit card account is valid.

    Payment methods, you can use in the iTunes Store, App Store and iBooks Store - Apple Support

  • Four updates are offered several times

    Original title: cannot install updates

    I ve downloaded the updates KB2656369, KB2418241, KB2539631 and KB2446704. After I install them, I get a message that says that they have been installed. But keep appearing as if they need to be installed again. And when run windows updates, they keep their appearance. I mannaged to install any other updates two which had the same problem, but that four, I just can´t.

    Art,

    See the article after some troubleshooting for your question:

    http://support.Microsoft.com/kb/910339/en-us >

    Please let us know if it did or did not help to solve your problem.

     
    UTC/GMT is 20:13 Saturday, October 20, 2012
  • Updates are offered several times

    Original title: KBs 2418241,2539631 and 2518864 appear in the form of updates despite the end of the installation

    Whenever I login I am prompted to install these updates despite their so-called installation the previous time. I tried them individually and collectively, by journey gets complete installation but still asked me to reinstall the next time that I am.

    Any ideas?

    Thank you

    Then you can simply hide ("do not show me these updates") all 3 three updates.

Maybe you are looking for

  • Error type: Yahoo.widget.overlay is not a constructor. Only get error in Firefox, and started this morning.

    There was an automatic Windows Update this morning. Since then, I get the error message "type: Yahoo.widget.overlay is not a constructor ' when I open certain websites such as ancestry.com. Other sites such as Facebook, do any work. Everything looks

  • P1102w: printer not connected

    Help! I upgraded my desktop to EL Capitan MAC computer and now my HP Laserjet does not work.  My preferences is not the printer either.  I can't find any printer updated driver on the HP site and my Apple support has no information either! I even con

  • Dashboard of data with sbRIO-9631

    I made one as VI of the directed fpga that turns on and off the led of the sbRIO and then it is used in real-time. I want to create a shared, variable so that I can see my led on and off in the dashboard of data and at the same time it should be on a

  • Locked BIOS of HP Mini 1000

    I can't enter my computer hp mini 1000 Code is: CNU9263NWD I don't remember the password for the life of me. Thanks for any help!

  • Error 0x800CCC0D code cannot receive or send emails in Windows Live Mail.

    Original title: I can't receive or send emails with Windows messenger live POP3 & SMTP server Can't send or receive messages with the POP3 account. Cannot find the POP3 host. Windows live mail error ID: 0x800CCC0D.  Port: 110 & Port 995 (ssl, secure)