Obtain count of values, including the values that are not in the table

I have values: 1,2,3,7,8,9
and my table contain value 3,7,8,3
I need get result of select
-value- -count-
-1-     -0-
-2-     -0-
-3-     -2-
-7-     -1-
-8-     -1-
-9-     -0-
I tried
select value, count(value) from table where value in ('1','2','3','7','8','9') group by value
but I get only
-value- -count-
-3-     -2-
-7-     -1-
-8-     -1-
Thank you for help

Thank you for help but this is not functional if values are text (varchar).Have you mentioned that ? In your example post you have mentioned only numeric values. Why don't you try yourself, When you have an working (? Oops, there is no version mentioned by OP, So may not be working) example ?
SQL> SELECT * FROM v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL> SELECT job,COUNT(job)
  2  FROM emp
  3  GROUP BY job;
JOB       COUNT(JOB)
CLERK              4
SALESMAN           4
PRESIDENT          1
MANAGER            3
ANALYST            2
SQL> SELECT column_value,COUNT(job)
  2  FROM emp e, TABLE(sys.odciVARCHAR2list('CLERK','PROGRAMMER','SALESMAN'
  3                                        ,'SALESMAN','DBA','PRESIDENT','MANAGER'
  4                                        ,'Architect','ANALYST')) t
  5  WHERE e.job(+)=t.column_value
  6  GROUP BY column_value
  7  ORDER BY 1;
COLUMN_VALUE
COUNT(JOB)
ANALYST
         2
Architect
         0
CLERK
         4
COLUMN_VALUE
COUNT(JOB)
DBA
         0
MANAGER
         3
PRESIDENT
         1
COLUMN_VALUE
COUNT(JOB)
PROGRAMMER
         0
SALESMAN
         8

Similar Messages

  • How to Find the Queries that are not hitting the indexes..

    Guys,
    Hope you all doin well.
    Would you guys please tell me any view , or any resource that can help me to identify those SQL Statements that are not hitting the indexes properly, Causing the system to slow down at peak times.
    Thanks
    Rgrds
    Y.Vo.

    any resource that can help me to identify those SQL Statements that are not hitting the indexes properlyInteresting ! Is there any specific reason of looking only for those queries, which are not making proper use of indexes.
    hare krishna
    Alok

  • Tzupdater.How it reflects the users that are not using the new USA DST rule

    If I update the JRE with tzupdater or just replace it with newer JRE will the time change according to the time zone I live in because I think that the changes in USA DST will not apply for the most of the other countries.

    Hi,
    You can do this directly in OAM, with option "a" (using auxiliary object class). You configure OAM to use the main person object class (inetorgperson) and then you can associate extra auxiliary object classes to it - and header variables can be set from any of the attributes that are in the user's profile, both main and auxiliary.
    Regards,
    Colin

  • My computer had to be repaired and i lost some of my purchases. my purchase history does not include the ones that are missing and the ones that do appear indicate they are free purchases.  none of my purchases are free i paid so how do a recover them?

    My computer had to be repaired and i lost some of my purchases. my purchase history does not include the ones that are missing and the ones that do appear indicate they are free purchases.  none of my purchases are free i paid so how do a recover them?

    asuming you are talking about the app store try signing into your account using your apple id into the app store.

  • When uploading pictures from my iPad to my PC it wants to upload 8117 pictures but I have 8052 on my iPad will clicking erase after upload delete all my pictures including the pictures that are not included in the u

    When uploading pictures from my iPad to my PC it wants to upload 8117 pictures but I have 8052 on my iPad will clicking erase after upload delete all my pictures including the pictures that are not included in the upload

    Sorry mixed my numbers up I was in such a hurry to post the question uploading 8052 but I have 8117

  • Best approach to delete records that are not in the source table anymore.

    I have a situation where I need to remove records from dimensions that are not in the source data anymore. Right now we are not maintaing history, i.e. not using SCD but planning for the next release. If we did that it would be easy to figure the latest records. The load is nightly and records are updated and new added.
    The approach that I am considering is to join the dimension tables the the sources on keys and delete what doesn't join. However, is there perhaps some function in OWB that would allow to do this automatically on import so it can be also in place for the future?
    Thanks!

    Bear in mind that deleting dimension records becomes problematic if you have facts attached to them. Just because this record is no longer in the active set doesn't mean that it wasn't used historically, and so have foreign key constraints on it in your database. IF this is the case, a short-term solution would be to add an expiry_date field to the dimension and update the load to set this value when the record disappears rather than to delete it.
    And to do that, use the target dimension as a source table, outer join it to the actual source table on the natural key, and so your update will set expiry_date=nvl(expiry_date,sysdate) to set to sysdate if this record has not already been expired on all records where the outer join fails.
    Further consideration: what do you do if the record is re-inserted into the source table? create a new dimension key? Or remove the expiry date?
    But I will say that I am not a fan of deleting records in most circumstances. What do you do if you discover a calculation error and need to fix that and republish historical cubes? Without the historical data, you lose the ability to do things like that.

  • Do we have any method to list out the servers that are critical and the component/monitor causing the server to turn into critical state in SCOM 2012

    Hello Team,
    We are monitoring 1000 servers in our environment and out of 1000 servers, we have approximately 100 servers showing as critical state on the server state view.
    We can get the critical servers list from SCOM console, but we are not able to get the information about the component responsible for the server to be critical. Using Health explorer to find the root cause for 100 servers is really impossible and time consuming.
    Do we have any method to list out the servers that are critical and the component/monitor causing the server to turn into critical state?
    Advance thanks for your help.
    Regards,
    Dinesh
    Thanks & Regards, Dinesh

    Hi,
    As far as I know alerts with severity as criticla may cause windows computer in a critical state, we can try below code to find all critical alerts:
    get-alert -criteria 'ResolutionState=0 AND Severity=2' | select Name,ResolutionState,TimeRaised | export-csv c:\Alerts.txt
    Criteria Syntax http://msdn.microsoft.com/en-us/library/bb437603.aspx
    Values to use.
    Resolution State 
    Severity Values for Alerts
    0       =   New
    0 = INFORMATIONAL
    255   =   Closed
    1 = WARNING
    2 = CRITICAL
    Hope this helps.
    Regards,
    Yan Li
    Regards, Yan Li

  • What is the command to verify the configuration that are not saved or sent to local controllers?

    Q: What is the command to verify the configuration that are not saved or sent to local controllers?
    A: We can execute the command that is shown in below image to check the status of the configuration that has been made.
    Note: For example I made changes to the default VAP profile and executed the command "show master-configpending" which shows the pending configuration to be saved/sent to local controllers.

    But that jar file loads without images and icons when it is in other directory.Images should be accessed via a URL rather than using a filename because they will exist as entries in the jar archive not as files. Typically this URL would be obtained by using the Class method [getResource()|http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResource(java.lang.String)]. There are details in this [Java World article|http://www.javaworld.com/javaworld/javaqa/2002-11/02-qa-1122-resources.html].

  • My mac's launchpad is working but i am not able to use the apps that are provided in the launchpad

    my mac's launchpad is working but i am not able to use the apps that are provided in the launchpad

    Well, everything that you have bought with her Apple ID prior to getting your own Apple ID is forever hers. Apple will not transfer content from one ID to another. But in the case of the Mac, contact iTunes Customer Service and request that they send your issue to the Account Security Team and ask that the Mac be released form your mother's account so you may register it with your account. Then you can accept the iLife apps into your account for any future updates.
    iTunes Support -
    http://www.apple.com/support/itunes/

  • How do you delete songs on iTune that are NOT on the library?

    I got a new computer few days ago, and I downloaded iTune on my new computer today.
    I want to delete all my songs that are in my iPod Touch now, and want to buy other songs.
    I don't have any songs in my library at the moment, since there's no song in my new computer now.
    So I want to delete songs, but since I don't have any of those songs in the library, I can't delete them. (I can't delete them since they are not on the library.)
    Are there any ways I can delete songs that are NOT on the library?

    You don't want to keep the songs that are on your iPod touch, in your library?
    You can keep them in your library and not put them on the touch.
    Then you can purchase other songs and put those on the touch.

  • Program To Identify the BP that are not assigned to transactions.

    Hai guys,
    I want to identify ALl the BPs that are not assigned to any of the Transactions like Oppurtunities,Activities etc in our system,
    I can run report bu using the tables But000 and CRM_ORDERADM_H.
    Is there any easy way i.e a standard program in the system that does the work.

    Follow these steps to get the list of BP's assigned to transactions
    1. Copy the order GUID's from CRMD_ORDERADM_H
    2. go to table CRMD_LINK paste the copied order guid in place of GUID_HI and copy the GUID_SET.
    3.go to CRMD_PARTNER and paste the above copied CRMD_LINK GUID_SET in place of CRMD_PARTNER GUID and copy the PARTNER_NO
    4.Go to BUT000 paste the above copied CRMD_PARTNER PARTNER_NO in place of GUID and get the partner number.
    Hope this helps out.
    Thanks,
    Thirumala.

  • How do you change the fields that are displayed on the email preview list after a search?

    How do you modify the fields that are displayed in the mail preview list in the center column of Mac mail after you conduct a search of your email?   All of a sudden the displayed fields changed on me whenever I do a search in mail.   When I have not filtered my email with a search, the default field shown in bold at the top of each message's preview is the "From" field.   However, when I do a search this changes to the "To" field.   Can anyone help?   Thanks, ccarey

    ipicus
    But why would you want this?
    iTunes is responsible for the File Management, let it get on with it, you do your organisation in the iTunes window. And everything you need to do, you can do via the iTunes Window. Want to find the file of a track quickly? Right click on it in the iTunes Window and select Show File: A finder window pops open with the file already selected.
    Regards
    TD

  • Best way to obtain records that are NOT in another table

    I have two rather large tables in oracle. An Account table that has millions of rows. Each account may be enrolled into a particular program and therefore can also be in an Enrollment table, also with millions of rows. I'm trying to find the most optimal way to find any accounts in ACCOUNT that are NOT in the Enrollment table.
    I was doing something like this:
    select /*+ index(ACCOUNT idx_acct_no) */
    a.acct_no
    from ACCOUNT a
    where a.acct_no not in (Select e.acct_no from ENROLLMENT e);
    This takes a VERY long time to execute, even though I am using the index.
    I even tried to use the PK on the ACCOUNT table, as it is also a FK on the ENROLLMENT table as such:
    select a.acct_no
    from ACCOUNT a
    where a.id not in (Select e.id from ENROLLMENT e);
    this too takes too long to get back (if at all).
    Is there a better way to do this selection please?

    Well if you have the energy to type in the whole list, the syntax you've given will work, unless you blow the permitted number of elements.
    But a practical solution would be to turn the list into a table. You still haven't got the hang of this "giving us enough information" concept, so let's presume:
    (1) you're on a version of the databasse whoch is 9i or higher
    (2) you have this list in a file of some sort.
    In which case use an external table or perhaps a pipelined function to generate output which can be used in a SQL statement.
    If neither of these solutions works for you please provide sufficient information for us to answer your question correctly. Your future co-operation is appreciated.
    cheers, APC

  • What are the boxes that are ticked in the delete recent history box on iMac

    what the boxes that are ticked in the delete recent history box

    Hello,
    Do you mean in Safari>Reset Safari... ?

  • HT201077 How do I view photos saved to "the cloud" that are not in my latest thousand??

    How do I view photos held "on the cloud" that have dropped off the phone, ie, are not in the latest 1000 stored.
    I cannot seem to find this "cloud"!

    hi guys thank you for the replies, sorry I have been away.
    I am confused then - I have had to buy more icloud memory recently (2 of us use it with phones etc and so share pics, music) but I thought this was because its saving more photos?
    So no idea why I have to buy storage if you now say photos arent saved?
    If gone from the last 1000 they are lost? I dont have a Mac just iphone/ipad.
    Sorry if Im getting it wrong!

  • How to select all the people that are not in any equipe  ?

    Hi,
    I have a nice SQL expression that gives me as a result all the "AGENTS" (people) that are working in an EQUIPE (a team)
    select a."AGENT_ID",
    a."NOM" || ' ' || a."PRENOM" "Nom",
    c.libelle "Equipe",
    a."DATE_EMBAUCHE" "Date embauche",
    a."DATE_DEBAUCHE" "Date débauche"
    from OBSERVATOIRE."AGENT" a,
    observatoire.equipe_agents b,
    observatoire.equipe c
    where a.agent_id = b.agent_id
    and b.equipe_id = c.equipe_id
    order by nom
    Now, how to select all the agents that are NOT working in any "EQUIPE" (team) ?
    I have tried but could not succeed !
    Thank you for your kind help.
    Christian

    Christian from France wrote:
    It is not working because the table EQUIPE_AGENTS does not contains a row if the agent is not into any equipe.
    CREATE TABLE "OBSERVATOIRE"."EQUIPE_AGENTS"
    (     "EQUIPE_AGENTS_ID" NUMBER NOT NULL ENABLE,
         "EQUIPE_ID" NUMBER NOT NULL ENABLE,
         "AGENT_ID" NUMBER NOT NULL ENABLE)
    CREATE TABLE "OBSERVATOIRE"."AGENT"
    (     "AGENT_ID" NUMBER NOT NULL ENABLE,
         "GRADES_ID" NUMBER NOT NULL ENABLE,
         "NOM" VARCHAR2(50 BYTE) NOT NULL ENABLE,
         "PRENOM" VARCHAR2(50 BYTE),
         "DATE_EMBAUCHE" DATE NOT NULL ENABLE,
         "DATE_DEBAUCHE" DATE)
    The only way to "know" if an agent is not into any equipe (team) is to search into the EQUIPE_AGENTS table, and if we do not find the ID of the agent into this table, then we know that this agent is not into any EQUIPE (team).
    I don't know ho to translate this into SQL.And that's what my query does. It uses an OUTER JOIN so that a result record is returned whether or not there is a record in EQUIPE_AGENTS. And the check for EQUIPE_ID is NULL restricts the result set to those where there IS NOT a record in EQUIPE_AGENTS.
    A more traditional way would be to use NOT IN or NOT EXISTS clauses, but they can prove inefficient.

Maybe you are looking for

  • Personal iPads in the enterprise - keeping work/personal apps separate

    Hi All, I work in IT for a school district.  Recently, we got a grant for iPad training.  As part of that training, every teacher that attended the classes was given an iPad.  The problem is, that because of the way the grant was structured, the iPad

  • Third Party Brush Issue

    I Installed Photoshop CS5 on my Computer. Went to a Third Party Obsidian Dawn Website I Dowmloaded Skin Texture Brushes. I Unziped the File to a Brush Folder. In the Brush Folder I Copied the Skin Texture Brushes.arb. Went to Drive C Left Click on It

  • Photoshop Help | Sync settings using Adobe Creative Cloud | Photoshop CC

    This question was posted in response to the following article: http://helpx.adobe.com/photoshop/using/sync-settings.html

  • No VGA output after upgraded to ios6 on ipad2

    I need help on the above. I have upgraded from ios5.1.1 to ios6 on my ipad 2. And bought a VGA connector to mirror ipad to my projector. But there was no output, in the projector, its message says "no signal detected". I have tried restored the ipad

  • Video sound to TV won't run through headphones

    Hi, I have my stereo and TV hooked up to a MacMini (the 2009 slim metal one with the optical drive).  I have a headphone splitter attched to the headphones jack going to the TV and the stereo.  The Mini is hooked up to the TV with a mini DP connector