How to get a separate account of several columns

I've done this before and I'll darn why I don't remember this.

A table with 3 columns with the primary key defined in the column.

Line a, b and c
NUM.
1 020 how abc
2 why 030 def
3 010 no IGS
4 how 040 abc
Yes def 5 050
6 060 why def

So what I want is a number of unique values to columns b and c as if b and c were in fact a field.

So the result of the query:
Count = 4 unique lines.

I hope I make some kind of sense. It is a bit much to know if the number of occurrences of each duplicate value, I know not just get the number of unique lines of lines not indexed will be enough. Because the query is supposed to be universal for several digital and alphanumeric data columns and can be extended for several columns, I'm just trying to get a basic skeleton which works for an analysis "on the fly".

It will be useful.

SQL>create table rb as select rownum A, rownum b , rownum c from dual connect by level < 11;

Table created.

Elapsed: 00:00:00.31
SQL>select count(distinct a) from Rb
  2  union all
  3  select count(distinct B ) from Rb
  4  union all
  5  select count(distinct c) from Rb
  6  /

COUNT(DISTINCTA)
----------------
              10
              10
              10

Elapsed: 00:00:00.53
SQL>update rb set b = 3 where B > 5;

5 rows updated.

Elapsed: 00:00:00.26
SQL>commit;

Commit complete.

Elapsed: 00:00:00.26
SQL>select count(distinct a) from Rb
  2   union all
  3   select count(distinct B ) from Rb
  4   union all
  5   select count(distinct c) from Rb
  6   /

COUNT(DISTINCTA)
----------------
              10
               5
              10

Elapsed: 00:00:00.53
SQL>

Tags: Database

Similar Questions

  • How to get special characters in the oracle column only

    Hi all

    with spec_tab

    as

    (

    Select ',' col1 of double

    Union

    Select ',' col1 of double

    Union

    Select 'something' double

    )

    Select col1

    of spec_tab

    How to get special characters in the oracle column only

    You mean like this?

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

    WITH spec_tab
         AS (SELECT ',,,,' col1 FROM DUAL
             UNION
             SELECT ',' col1 FROM DUAL
             UNION
             SELECT 'some thing' FROM DUAL)
    SELECT col1
      FROM spec_tab
      where translate('~'||col1,'~0123456789abcdefghijklmnopqrstuvwxyz ','~')<>'~'
    

    Output:

    -----

    COL1

    ,

    ,,,,

    See you soon,.

    Manik.

  • How to get the names of the table columns in the quick dashboard

    How to get the names of the table columns in the quick dashboard


    Thanks and greetings
    ------------------------
    Kishore P

    Make a prompt like:

    SELECT case when 1 = 0 then 'D0 time. " "" T02 by month name "other" 'D2 market' '. "" M04 region' ' the end 'Sample Sales' UNION ALL SELECT case when 1 = 0 then 'D0 Time. " "" T02 by month name ' else ' 'Time D0. "" T02 by month name ' ' the end 'Sample Sales.

    Put the name of column in single quotes.

    Make your rank as a function:
    Rank ('F1 income'. "" Recipes 1-01 (after all) "by @{pColumn} {'D0 time'. ({"" T05 annually name '})

    It works fine for me

    concerning

    John

    http://obiee101.blogspot.com

  • How to get a trial account or a Connect meeting room product

    How to get and install a room of Adobe?

    Thank you

    Post edited by: ashish gupta. to add a meaningful title.

    You can get a 30 day trial here: http://www.adobe.com/go/try_adobeconnect/

    You can contact a dealer out of this list: http://www.adobe.com/products/adobeconnect/strategic-partners.html

    If you wish, you can contact me off forum jorma [at] realeyesconnect.com and I'd be happy to help you identify which license is right for you.

  • How to get data from one or several times of perticuler dates

    (1) how can we get data from one or more dates perticuler.
    for example. date of 01/01/2011 and time is 00:00:00 to 23:59:59

    and

    (2) how can we get data from one or more dates perticuler.
    from date 01/01/2011 to 01/02/2011 date and time e.g. is from 00:00:00 to 23:59:59.

    can we?

    Hello

    Use a WHERE clause to include only certain lines.
    For example:

    SELECT     *
    FROM     table_x
    WHERE     dt     BETWEEN TO_DATE ( '01/01/2011 00:00:00'
                        , 'DD/MM/YYYY HH24:MI:SS'
                        )
              AND     TO_DATE ( '01/01/2011 23:59:59'
                        , 'DD/MM/YYYY HH24:MI:SS'
                        )
    ;
    

    In this example, the first date (before the keyword AND) and second (after the keyword AND) lie on the same calendar day. It's just a coincidence, they can be on different dates.
    The first date must not be later than the date of the second; If this is the case, you will get 0 found lines.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

  • How to get the use of database tables/columns in the table of edge/analysis?


    Hi all

    Anyone has an idea on how to get the tables in DB/colomns usaged in edge/analysis table in OBIEE 11 G?

    Thanks in advance!

    Anne

    You can try to generate a report of Catalog Manager for analysis / SA want to create the line and your RPD you can go to utilities > documentation of the repository and get the domain you want to and get all the mappings in Excel format.

    I hope this helps.

    SVS

  • How to get the value of a particular column column name?

    Hi all

    How to get the column name for a particular column value.
    example:

    create table test (ID number, col2, col3 varchar varchar);

    Insert into test values (1, 'true', 'false');
    Insert into test values (2, 'false', 'true');
    commit;

    I want to choose the name of the data column 'true' with id = 1;

    That is to say) while waiting for answer is "col2". pls help someone.

    This might help:

    DECLARE
       c1 SYS_REFCURSOR;
    BEGIN
       OPEN c1 FOR
       SELECT col2,
              col3
       FROM   test
       WHERE  id = 1;
       --
       FOR c IN (SELECT rownum rn,
                        t2.column_value.getrootelement() name,
                        EXTRACTVALUE(t2.column_value, 'node()') value
                   FROM TABLE(XMLSEQUENCE(c1)) t,
                        TABLE(XMLSEQUENCE(EXTRACT(column_value, '/ROW/node()'))) t2)
       LOOP
          IF c.value = 'true' THEN
             DBMS_OUTPUT.PUT_LINE(c.name);
          END IF;
       END LOOP;
    END;
    
  • How to get a user account who disappeared?

    I created a limited user account for my son, and when I am connected to my computer the next day, my owner account was gone.  Where it's going and how do I get it back?

    Hi DoodyDave,

    Do you mean that you can not see the name of the account in the home screen? Log on to your system as administrator (press ALT CTRL DEL, twice at the Welcome screen).

    Now click on start-> Run Type &-> Regedit-> ok.

    Navigate to HKEY_LOCAL_MACHINE-> SOFTWARE-> Microsoft-> Windows NT-> CurrentVersion-> Winlogon-> SpecialAccounts-> UserList

    Double-click the name of your account, and set the value to 1.

    When the computer reboots, you will get your account name in the Welcome screen.

    I hope this helps.

  • How to get back my account?

    I disabled my user admin by accident group. Now my account is just a standard user. I can't update any software. When I try is States do you want to make changes on the hard disk. There is no place to put a password. How do I change back to full administrative privileges. I know my password, but it won't let me re enable it. My nerves are completely missing. Help, please. Thank you

    Hello

    Use the hidden administrator account to trigger your admin account.

    DO NOT USE THE ACCOUNT HIDDEN ON A DAILY BASIS! If it corrupts you are TOAST.

    How to enable or disable the built-in Windows 7 Administrator account
    http://www.SevenForums.com/tutorials/507-built-administrator-account-enable-disable.html

    Use the hidden administrator account to lower your user account APPLY / OK and then lift it to ADMIN.
    This allows clear of corruption. Do the same for other accounts if necessary after following the above message.

    You can use the hidden - administrator account to make another account as ADMINISTRATOR with password even
    (or two with the same password) use a test or fix the other.

    You can run the Admin account hidden from the prompt by if necessary.

    How Boot for Windows 7 System Recovery Options or use a Windows 7 boot disk.
    http://www.SevenForums.com/tutorials/668-system-recovery-options.html

    What are the system recovery options in Windows 7?
     http://Windows.Microsoft.com/en-us/Windows7/what-are-the-system-recovery-options-in-Windows-7

    How to create a Windows 7 system repair disc
    http://www.SevenForums.com/tutorials/2083-system-repair-disc-create.html

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • How to get the phone to ring several times before the voicemail picks up

    Is there a setting to let the phone ring several times before the voicemail picks up

    This option will be controlled by your wireless operator. Contact them to determine whether it is possible to change the response time of voicemail.

  • How to get my itunes account is back with all my songs and how do I sync them to ipod nano

    help with itune cannot find my songs and account information want to add music to the ipod nano that I just bought

    Try https://iforgot.apple.com

    TT2

  • How to get all the accounts of messaging on a single device

    as the title

    Search recursively to find all emails. Check out this article, it gives hint on how to search recursively.

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800698/What_Is...

  • How to get to the internet through several VLANs

    I have 20 and 2 vlan configuration vlan10.
    vlan10 can talk to vlan20 and vice versa.

    Gateway ip: 192.168.1.250

    The only remaining problem is, customers/workstation on the VLANs can not access internet.
    Here is my current config.

    -----------------------------------------------------------------------------------------------------------------------------------
    ! Current configuration:
    ! Description of the system "PowerConnect 6248, 3.3.4.1, VxWorks 6.5.
    ! 3.3.4.1 system software version
    ! Passage mode is configured as disabled
    !
    Configure
    database of VLAN
    VLAN 10.20
    VLAN 10 1 routing
    VLAN 20 2 routing
    output
    battery
    1 2 Member
    output
    IP address no
    IP routing
    Route IP 192.168.10.0 255.255.255.0 192.168.1.250
    IP route 192.168.20.0 255.255.255.0 192.168.1.250
    interface vlan 10
    Routing
    IP 192.168.10.1 255.255.255.0

    output
    interface vlan 20
    Routing
    address 192.168.20.1 255.255.255.0
    output
    !
    interface ethernet 1/g1
    switchport access vlan 10
    output
    !
    interface ethernet 1/g2
    switchport access vlan 10
    output
    !
    interface ethernet 1/g3
    switchport access vlan 10
    output
    !
    interface ethernet 1/g4
    switchport access vlan 10
    output

    !
    interface ethernet 1/g5
    switchport access vlan 10
    output
    !
    interface ethernet 1/g6
    switchport access vlan 10
    output
    !
    interface ethernet 1/g7
    switchport access vlan 20
    output
    !
    interface ethernet 1/g8
    switchport access vlan 20
    output
    !
    interface ethernet 1/g9
    switchport access vlan 20
    output
    !

    interface ethernet 1/g10
    switchport access vlan 20
    output
    !
    interface ethernet 1/g11
    switchport access vlan 20
    output
    !
    interface ethernet 1/g12
    switchport access vlan 20
    output
    !
    interface ethernet 1/g48

    switchport mode trunk
    switchport trunk allowed vlan add 10.20
    output
    output

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

    I just for the route on gateway. :-)

    Honestly, I didn't apply / edit my gateway settings, but the scenario had left me no place but
    want to change. Kind of wanting the power of layer 3 cap-abilities.

    After adding 2 static routes x to the gateway. Clients/workstations were able to ping 8.8.8.8
    (or access the internet).

    Here are the current routes.

    Route ip console #show

    The traffic code: R - RIP derived, O - OSPF derived, C - connected, S - static
    B - BGP derived, IA - OSPF Inter zone
    E1 - OSPF external Type 1, E2 - OSPF external Type 2
    N1 - OSPF NSSA external Type 1, N2 - OSPF NSSA external Type 2

    S 0.0.0.0/0 [1/0] via 192.168.77.254, vlan 30
    C 192.168.10.0/24 [0/1] directly connected, vlan 10
    192.168.20.0/24 C [0/1] directly connected, vlan 20
    192.168.77.0/24 C [0/1] directly connected, vlan 30

    Able to ping gateway now.

    Reply from 192.168.77.254: bytes = 32 time<1ms ttl="">
    Reply from 192.168.77.254: bytes = 32 time<1ms ttl="">
    Reply from 192.168.77.254: bytes = 32 time<1ms ttl="">
    Reply from 192.168.77.254: bytes = 32 time<1ms ttl="">

    Able to ping google now as well.

    Response of 8.8.8.8: bytes = 32 time = 25 ms TTL = 49
    Response of 8.8.8.8: bytes = 32 time = 25 ms TTL = 49
    Response of 8.8.8.8: bytes = 32 time = 17ms TTL = 49
    Response of 8.8.8.8: bytes = 32 time = 16 ms TTL = 49

    Thanks Blake for that, passing by really appreciate it. I hope this will be useful to others;
    who know the * treats * Powerconnect 6200 series.

    FMP

  • How to get the list in a single column in a query

    Hello.

    I wonder if there is a way to get a query (no pl/sql code) a list of columns with a separator between them.

    I know I can get that without separators with an expression of cursor:
    SQL> with test_table as (
      2  select 1 col1, 'a' col2 from dual
      3  union
      4  select 1 col1, 'b' col2 from dual
      5  union
      6  select 1 col1, 'c' col2 from dual
      7  union
      8  select 2 col1, 'a' col2 from dual
      9  union
     10  select 2 col1, 'c' col2 from dual
     11  union
     12  select 2 col1, 'd' col2 from dual
     13  union
     14  select 2 col1, 'z' col2 from dual
     15  )
     16  select col1, cursor (select b.col2 from test_table b where b.col1 = a.col1 order by b.col2) col2_list from test_table a
     17  group by col1
     18  /
    
          COL1 COL2_LIST
    ---------- --------------------
             1 CURSOR STATEMENT : 2
    
    CURSOR STATEMENT : 2
    
    C
    -
    a
    b
    c
    
             2 CURSOR STATEMENT : 2
    
    CURSOR STATEMENT : 2
    
    C
    -
    a
    c
    d
    z
    But the result I want is (by using the separator ';'):
          COL1 COL2_LIST
    ---------- --------------------
             1 a;b;c
             2 a;c;d;z
    I don't know how to manage a cursor expression without using a pl/sql function block. Can it be done using analytical functions?

    Thanks in advance.

    Hello

    This is called 'aggregation of chain.
    This site:

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2196162600402

    shows different ways to do this, including the SYS_CONNECT_BY_PATH solution which gave Blushadow.

    I got a lot of use of the first solution on this page, the function defined by the user STRAGG, that you can copy.

    Once you have installed STRAGG, your query is simply

    SELECT    col1
    ,         STRAGG (col2)     AS col2_list
    FROM      test_table
    GROUP BY  col1;
    

    The query above do not put items in a particular order.

    On Oracle 10 (and more) you can have a similar function, the WM_CONCAT (property WMSYS), already installed.
    WM_CONCAT is not documented, so you can't use it in your Production applications.

  • How to get the Max value with other columns data also.

    Suppose that a query is covered with the data as

    Time of ID
    01 07/12/2014
    02 07/05/2014
    03 16/07/2014
    04 07/07/2014

    I need to get the ID and time to time max.
    that is, should I get
    Time of ID
    03 16/07/2014

    To do this, I wrote a query that gives me necessary data. But I thought that's the best way?
    Is it an effective way to get this data?
    My query that returns the data required is:

    SELECT ID, MAX_DT FROM
    (
    Select 'DUMMY', ID, TIME1, MAX (TIME1) OVER (PARTITION 'DUMMY') AS MAX_DT FROM TAB1
    WHERE ID IN (BLAH BLAH)
    )
    WHERE MAX_DT = (EDT) 1

    Frank mentioned links


    WITH test_data (id, time) LIKE)

    SELECT 01, to_date('2014/07/12','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 02, to_date('2014/07/16','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 03, to_date('2014/07/16','yyyy-mm-dd') FROM dual

    UNION ALL

    SELECT 04, to_date('2014/07/07','yyyy-mm-dd') FROM dual

    )

    SELECT id, time

    go (select id,

    time,

    Max (Time) on latest_time (order by time lines between unbounded preceding and following unbounded)

    of test_data

    )

    where time = latest_time

    ID TIME
    3 16/07/2014
    2 16/07/2014

    Concerning

    Etbin

Maybe you are looking for