Get the number of DISTINCT from several columns

How can I get the number of DISTINCT from several columns?
SQL> select count(distinct ename) from emp;

COUNT(DISTINCTENAME)
--------------------
                  14

SQL> select count(distinct ename, job) from emp;
select count(distinct ename, job) from emp
       *
ERROR at line 1:
ORA-00909: invalid number of arguments

Hello

select count(distinct ename || job) from emp;

Kind regards

Tags: Database

Similar Questions

  • Requirement of Beeping - how to get the number of combination of several columns

    Hi gurus, Experts and all,.

    Help me please how this code to the BEEP.

    I need to get the number of each combination of 6 columns if the combination is repeated.

    Columns example: number team responsible for Group Type reason
    The example columns: placed Team1 M1 M1 T1 won 2
    GroupA Team1 H2 M2 T1 loss 1
    GroupB Team2 H2 M3 T2 won 1
    GroupB Team2 H3 M3 T2 loss 2

    Thank you very much

    Jean Paul
    BEEP newbie

    Published by: user10955574 on October 28, 2010 20:15

    Published by: user10955574 on October 29, 2010 03:06

    I sent you the file. Check your mailbox.

  • get the number of desktops from a pool

    Hi all

    I search through the internet for some time but could not find any useful information for my script.

    I'm trying to get the number of view desktop computers already in use in a swimming pool and computers Office Max County.

    My script should analyze these two and send me an email when the normal County reached the maximum.

    As we are still in the construction of the environment of the view, new users are added to the RFA constantly for pools are fill up quickly.

    Also we don't want huge pools so a fixed limit is necessary and must be verified.

    I thought with a script it would be the best method, can someone help me here?

    Thank you

    CR

    Try something like that.

    By pool, it will show you how many workstations are used.

    Get-Pool | Select Pool_id,DisplayName,@{N="#Desktops";E={$_ | Get-DesktopVM | Measure-Object | Select -ExpandProperty Count}}
    
  • With the help of TestStand to get the number of errors from a device

    I use TestStand to communicate with a device that tests itself. TS has just appealed a DLL which, through a channel series learns how many errors the device had for each test (such as ethernet). It must be continuously for each test for approximately 3 days. While I realize that this is not the way that TS is supposed to work, due to the end already be finished I just simple settle.

    My question is:

    What is the best way to organize the test steps (calls DLL that returns the number of errors) and the results? I looked at just looping through a test sequence, but this would result in millions of individual results altogether? Is there a way to update the same result for a stage, when it is called 1000 times?

    Thank you

    Add each error to a variable in a loop that runs for 3 days. Save the variable data to the report at the end.

  • Select the records from the first n distinct values of column

    I need to write a query in plsql to select records for the first 3 values distinct from a single column (example below, ID) and all lines for the next 3 distinct values of column and so on until the end of the number of distinct values in a column.
    for example:
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10
    7 lmn 10
    .
    .
    .
    so now... (up to a few County)
    Result must be
    1 the application should result->
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr

    Query 2 should lead to->
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10

    Query 3 should lead to->
    7 lmn 10
    .
    .
    9... ..
    so now...
    How to write a query for this inside a loop.

    Hello

    Thus, a panel will consist of the lowest id value, the 2nd lowest and the 3rd lower, reggardless of how many lines is involved. The next group will include the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you must assign the numbers 1, 2, 3, 4, 5, 6,... for the rows in order by id, with all lines with the same id, getting the same number and without jumping all the numbers.
    This sounds like a job for the analytical DENSE_RANK function:

    WITH     got_grp_id     AS
    (
         SELECT     id, name, age
         ,     CEIL ( DENSE_RANK () OVER (ORDER BY id)
                   / 3
                   )          AS grp_id
         FROM     table_x
    )
    SELECT     id, name, age
    FROM     got_grp_id
    WHERE     id     = 1     -- or whatever number you want
    ;
    

    If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
    See the FAQ forum {message identifier: = 9360002}

  • How to get the string (specified by row and column) of txt file with labview

    Hello world

    How to get the string (specified by row and column) of txt file with labview

    THX

    As far as I know, a text file has no column.  Be more specific.  Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character?  You can read from the spreadsheet String function and set the delimiter to a space.  This will produce a 2D channels table.  Then use the table to index and give the line number and column number.

  • Get the number of the month

    DB version: 10 gr 2

    I was asked to give a slow query performance.

    I think that he is trying to get the number of months (as of June 6, July 7) after a few months to add logic. I replaced the column date with sysdate.

    The query looks like
    SELECT TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('01-'||TO_CHAR(sysdate,'MON-RRRR'),'DD-MON-RRRR'),3),'MM')) from dual
    Is there room for improvement?

    Hello

    What is

    select EXTRACT(MONTH FROM sysdate) from dual;
    

    Concerning
    Peter

  • Query to get the number of records

    Hi all

    I would get the number of records in all tables in a schema. I don't want to run select count (*) of < table name >, because there are nearly 400 paintings. So I need a generic quqeyr that will give the recordcount for all tables.

    Experts good help yourslef to tide me over.

    Do you need a specific account? Or an approximate count is sufficient? Do you use the RBO and CBO?

    If you use the CBO and want an approximate count, column NUM_ROWS USER_TABLES should give you what you want.

    If you need a specific account, you will have full scan all tables. You can automate this process via SQL dynamic, i.e.

    DECLARE
      l_cnt INTEGER;
    BEGIN
      FOR x IN (SELECT table_name FROM user_tables)
      LOOP
        EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || x.table_name INTO l_cnt;
        dbms_output.put_line( 'Table ' || x.table_name || ' has ' || l_cnt || ' rows.' );
      END LOOP;
    END;
    

    Lawrence was also a [solution based on XML Query | http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html] to count all the rows in each table in a schema.

    Justin

  • How to get the number of fonts online

    Hi all

    can you give me solution to the following:

    How to get the number of fonts on a line.

    Ex

    BlackBerry Support 'Community' is supported for my career

    in this line, I want to ITALIC for the word 'Community '.

    Font.GetDefault (). Derive from wil give for total line...

    RichTextField does not?

    See this KB article

    http://supportforums.BlackBerry.com/T5/Java-development/format-text-in-a-RichTextField/Ta-p/445038

  • BlackBerry Smartphones personal names in address book are not displayed when they only call the number they call from?

    My number is displayed only in the next issues of appeal.

    When someone I recorded in my book calls address their name used to display, now I get only the number they call from?

    Do I have to change a setting?

    Why the name sop appearing?

    He has a bee a few weeks now?

    I removed the battery and electric bike

    Don't check for updates... any help

    Went to a Verizon Center... no help!

    I can't thank you enough

    I went to the article and he's referring to this:

    It was caused by a bad security parameter, called content protection!

    I enclose the item for later use, it's a real miracle solution, you're very kind!

    Summary of the Causes

    This problem may be caused by one of the following:

  • get the number in the declaration of DBMS

    Hello everyone,

    my friend, I create the following code, but I've always faced a problem to display the result of County all the

    the code is:

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

    I insert a count (*) to get the number of employees

    but he keep get only '1' to the last of the result in the following way:

    DETAILS OF THE EMPLOYEE:

    YJOSEPH5 | YOUSEFJOSEPH | 15 NOVEMBER 15

    HYOUSEF10 | HASSANYOUSEF | 15 NOVEMBER 15

    HYOUSEF17 | HASSANYOUSEF | 15 NOVEMBER 15

    HYOUSEF14 | HASSANYOUSEF | 15 NOVEMBER 15

    HYOUSEF16 | HASSANYOUSEF | 15 NOVEMBER 15

    COUNT: 1

    the code

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

    DECLARE
    V_USER_ID VARCHAR2 (50);
    NUMBER OF V_EMP_NO;
    V_FIRST_NAME VARCHAR2 (30);
    V_LAST_NAME VARCHAR2 (30);
    DATE OF V_REG_DATE;
    NUMBER OF V_COUNT;
    V_SQL_SATEMENTS VARCHAR2 (1000);
    NCOUNT THE NUMBER;
    CURSOR C IS SELECT USER_ID, EMP_NO, FIRST_NAME, LAST_NAME, REG_DATE, COUNT (*) FROM EMP
    USER_ID, FIRST_NAME, LAST_NAME, EMP_NO, REG_DATE GROUP;
    BEGIN
    OPEN C;
    SELECT COUNT (*) FROM NCOUNT FROM USER_TABLES WHERE TABLE_NAME = 'EMP ';
    IF (NCOUNT < = 0) THEN
    V_SQL_SATEMENTS: =' CREATE TABLE EMP)
    USER_ID VARCHAR2 (40) PRIMARY KEY,.
    NUMBER OF EMP_NO,
    FIRST NAME VARCHAR2 (30),
    VARCHAR2 (30) LAST_NAME,.
    DATE OF REG_DATE)';

    RUN IMMEDIATELY "DROP TABLE EMP;
    IMMEDIATELY RUN V_SQL_SATEMENTS;
    END IF;

    SELECT NVL (MAX (EMP_NO), 0) + 1
    IN V_EMP_NO
    YOUSEF. EMP;
    INSERT YOUSEF. EMP (USER_ID, EMP_NO, FIRST_NAME, LAST_NAME, REG_DATE)
    VALUES (SUBSTR (: LAST NAME, 1, 1) |: LAST_NAME |) V_EMP_NO, V_EMP_NO,:FIRST_NAME,:LAST_NAME,TO_DATE(SYSDATE,'DD-MON-YY'));
    DBMS_OUTPUT. PUT_LINE (' DETAILS OF THE EMPLOYEE: "");
    LOOP
    EXTRACT THE C IN V_USER_ID, V_EMP_NO, V_FIRST_NAME, V_LAST_NAME, V_REG_DATE, V_COUNT;
    WHEN THE EXIT %C NOTFOUND;

    DBMS_OUTPUT. PUT_LINE (V_USER_ID |'|) ' || V_FIRST_NAME | V_LAST_NAME |' | ' || V_REG_DATE);
    END LOOP;
    DBMS_OUTPUT. PUT_LINE ("COUNT:" | "|") V_COUNT);

    CLOSE C;
    END;
    /

    ALL FRIENDS,

    THANKS FOR EVERY BODY,

    I JUST FOUND THE RIGHT WAY TO DO

    FOR THOSE WHO WANT TO SEE:

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

    DECLARE
    V_USER_ID VARCHAR2 (50);
    NUMBER OF V_EMP_NO;
    V_FIRST_NAME VARCHAR2 (30);
    V_LAST_NAME VARCHAR2 (30);
    DATE OF V_REG_DATE;
    NUMBER OF V_COUNT;
    V_SQL_SATEMENTS VARCHAR2 (1000);
    NCOUNT THE NUMBER;
    CURSOR C IS SELECT USER_ID, FIRST_NAME, LAST_NAME, EMP_NO FROM EMP REG_DATE;
    BEGIN
    SELECT COUNT (*) IN THE EMP V_COUNT;
    OPEN C;
    SELECT COUNT (*) FROM NCOUNT FROM USER_TABLES WHERE TABLE_NAME = 'EMP ';
    IF (NCOUNT<=0)>
    V_SQL_SATEMENTS: =' CREATE TABLE EMP)
    USER_ID VARCHAR2 (40) PRIMARY KEY,.
    NUMBER OF EMP_NO,
    FIRST NAME VARCHAR2 (30),
    VARCHAR2 (30) LAST_NAME,.
    DATE OF REG_DATE)';
                                             
    RUN IMMEDIATELY "DROP TABLE EMP;
    IMMEDIATELY RUN V_SQL_SATEMENTS;
    END IF;

    SELECT NVL (MAX (EMP_NO), 0) + 1
    IN V_EMP_NO
    YOUSEF. EMP;
    INSERT YOUSEF. EMP (USER_ID, EMP_NO, FIRST_NAME, LAST_NAME, REG_DATE)
    VALUES (SUBSTR (: LAST NAME, 1, 1) |: LAST_NAME |) V_EMP_NO, V_EMP_NO,:FIRST_NAME,:LAST_NAME,TO_DATE(SYSDATE,'DD-MON-YY'));
    DBMS_OUTPUT. PUT_LINE (' DETAILS OF THE EMPLOYEE: "");
    LOOP
    EXTRACT THE C IN V_USER_ID, V_EMP_NO, V_FIRST_NAME, V_LAST_NAME, V_REG_DATE;
    WHEN THE EXIT %C NOTFOUND;

    DBMS_OUTPUT. PUT_LINE (V_USER_ID |'|) ' || V_FIRST_NAME | V_LAST_NAME |' | ' || V_REG_DATE);

    END LOOP;

    CLOSE C;
    DBMS_OUTPUT. PUT_LINE ("COUNT:" | "|") V_COUNT);

    END;
    /

  • Need a counter of the number of occurrences in a column.

    Hello world.

    I have 2 tables.  A table is a simple table with the columns NAME and ID (unique).  Table B has a lot of columns, but also a column called matching NAME of a constraint on Table A ID FK.

    For a report, I need to create view with columns...  ID and COUNT.

    Basically, for each ID in table A, I need to get the number of times it appears in the name column of the Table B.

    What is the best way to do this in Oracle PL SQL.  I have version 11g, 10.3.6.

    Thank you

    CREATE OR REPLACE FORCE VIEW 'NAMES_VIEW' ('ID', 'COUNT') AS

    Select A.ID AS 'ID', COUNT (A.ID) AS 'COUNT '.

    of TABLE A, TABLE B

    where A.ID = B.ID

    B.NAME GROUP

    /

  • Get the number of days in a month based on the month and year of fields

    I have a column in my form which lists the days in a month. I want to configure a hidden field that calculates the total number of days in a month, based on the month and year of the field inputs. The number of days will determine what appears on the column. For example, if I put 4 months, and 2016 in the field of the year, I get 30 in the hidden field. Thus, on the column 'Day', I'll have numbers 1-30. Or if I put 2 months and 2016 in the field of the year, I get the 29 in the hidden field. If the numbers 1-29 appears in the column 'day '.

    Found this on some forum javascript code:

    //Month is 1 based
    function daysInMonth(month,year) {
      
    return new Date(year, month, 0).getDate();
    }

    //July
    daysInMonth
    (7,2009); //31
    //February
    daysInMonth
    (2,2009); //28
    daysInMonth
    (2,2008); //29

    I do not know how to convert this code in JavaScript to adobe and don't really know how to use it. All I know how to do is to configure the field values for the field month and year as variables. I am a novice programmer and would appreciate it really all the help I can get. Thank you in advance!

    The code seems to be JavaScript and runs as needed by using the JavaScript console.

    I would like to consider making more general code, so if you have a date string that includes at least the month and year we could just call the function and get the number of days for that month.

    The following script will calculate the number of days in a month, by using at least the month and year values can display the result on the JavaScript console and all of the value field for the field that has this code as the custom calculation Script.

    function daysInMonth (oDate) {}
    return new Date (oDate.getFullYear (), oDate.getMonth () + 1, 0) .getDate ();
    }

    nMonth var = this.getField("Month").valueAsString; get the value of month;
    nYear var = this.getField("Year").valueAsString; get the value of the year;

    Event.Value = "";

    If (nMonth! = "" & nYear!) = "") {}
    var MyDate = util.scand ("' / mm/yyyy ', nMonth +" / "+ nYear); convert to date object;
    var nDaysInMonth = daysInMonth (MyDate); get the number of days;

    Console.Open (); Open the JavaScript console;

    Console.clear(); clear the console;

    Console.println ("Days in" + nMonth + ":" + nDaysInMonth); show days in month;

    Event.Value = nDaysInMonth; Set the value of the field;

    }

  • I can't go past the phase of 'redemption' in the elements.  I enter the number I got from Amazon, where I downloaded the program, but was told by Adobe that it is incorrect.  Help!

    I can't go past the phase of 'redemption' in the elements.  I entered the number I got from Amazon, where I downloaded the program, but Adobe says that the number is the wrong code.

    Hello

    because you have purchased your product on Amazon, you do not have a serial number, only a code with which you can request a serial number from Adobe. Please take a look at http://helpx.adobe.com/x-productkb/global/find-serial-number.html. (Start here: How did you purchase your product?)

    The next part, so I don't see at the very least, ceased to exist on my Adobe website, everything happens in the link above. I leave as an info yet, he could still fit for you. For this purpose, please click your way through your Adobe Store and find the button "get serial number". Fill in the form and after awhile, you will get the real serial number.

    Good luck!

    Hans-Günter

  • How can I get the number of rows in the table using Sunopsis API target in ODI 10 g?

    Hi guys,.

    In fact, I want to send an alert message as soon as the interface is run from a package. I've included alert OdiSendMail that sends an email once the interface is running.

    Could someone please tell how to get the number of rows inserted into the table the Sunopsis API target.

    I tried to use < % = odiRef.getNbRows () % >, but this has not worked for me. Since I am a beginner, could you please help out me

    This is my mail to send ODI format

    "The population of data managed to < % = odiRef.getSysDate () % >

    Total of lines in the target table is: < - need an API code-> "


    Kind regards

    Clinton

    Published by: LawrenceClinton on February 25, 2013 20:53

    Hello

    Create the project with details below variable

    Nom_de_variable: Total_Row_Count

    Type of variable: Variable discount

    Definition tab:
    Data type: digital
    Action: No persistent

    Refresh the tab:
    Schema: provide the schema of your repository to work and be

    SELECT log.nb_row
    THE journal of snp_step_log, snp_scen_step step
    WHERE log.nno = step.nno
    AND step.scen_no = (SELECT scen_no FROM snp_scen_step WHERE step_name='<%=odiRef.getPrevStepLog ('STEP_NAME") % > ')
    AND log.sess_no = '< % = odiRef.getSession ("SESS_NO") % >' code at low
    AND step.step_name = ' < % = odiRef.getPrevStepLog ("STEP_NAME") % > '

    Note: add this variable after the stage of interface in your package (after the interface anywhere you can place), you can add this variable before ODISendEmailNotification in your package

    call this varciable * #Total_Row_Count * in the Notification of ODISendEmail

    for example :

    Data has been fulfilled successfully in < % = odiRef.getSysDate () % >
    Total no of lines filled are: * #Total_Row_Count *

    it will work

    cordially,
    Phanikanth

    edited by: Phanikanth on February 28, 2013 01:13

    edited by: Phanikanth on February 28, 2013 01:14

Maybe you are looking for