Counting records

Hi all

I have a table as below

critId class Type Level
1234010101
5678020202
9012030303
3456010101
7890030303
1593040404
2604050505
3715040404

I want to find the list of the critId who have exactly a set of class, type, and value of level.

critId class Type Level
5678020202
2604050505

or something like combination of class number, type and level

County class type of level
2010101
1020202
2030303
2040404
1050505

Must be addressed on the SELECT GROUP BY...

user10923327 wrote:

I want to find the list of the critId who have exactly a set of class, type, and value of level.

critId class Type Level
5678 02 02 02
2604 05 05 05

with TABLE_LIKE_BELOW as

(

Select critid 1234, 01 class1, 01 type1 01 level1 Union double all the

Select critid 5678, 02 02 class1, type1 02 Union level1 double all the

Select critid 9012, 03 03 class1, type1 03 Union level1 double all the

Select critid 3456, 01 class1, 01 type1 01 level1 Union double all the

Select critid 7890, 03 03 class1, type1 03 Union level1 double all the

Select critid 1593, class1 04, 04 04 Union level1 type1 double all the

Select critid 2604, 05 class1, type1 05 05 level1 Union double all the

Select critid 3715, class1 04, 04 04 double level1 type1

)

Select count (1), class1, type1, level1

of TABLE_LIKE_BELOW

Group of class1, type1, level1

given the number (1) = 1

user10923327 wrote:

or something like combination of class number, type and level

count class type level
2 01 01 01
1 02 02 02
2 03 03 03
2 04 04 04
1 05 05 05

with TABLE_LIKE_BELOW as

(

Select critid 1234, 01 class1, 01 type1 01 level1 Union double all the

Select critid 5678, 02 02 class1, type1 02 Union level1 double all the

Select critid 9012, 03 03 class1, type1 03 Union level1 double all the

Select critid 3456, 01 class1, 01 type1 01 level1 Union double all the

Select critid 7890, 03 03 class1, type1 03 Union level1 double all the

Select critid 1593, class1 04, 04 04 Union level1 type1 double all the

Select critid 2604, 05 class1, type1 05 05 level1 Union double all the

Select critid 3715, class1 04, 04 04 double level1 type1

)

Select count (1), class1, type1, level1

of TABLE_LIKE_BELOW

Group of class1, type1, level1

Tags: Database

Similar Questions

  • How to count records in doubles in a table

    Hello

    Could you please post the request to count duplicate records and to display the records in doubles in a table.
    IAM using oracle 10g.


    Thank you and best regards,
    Harish

    It won't be easy to write the query if we have the structure of the table and what you think of duplicates?

    Select ename, empno, count (*)
    WCP
    Group by empno, ename
    having count (*) > 1

  • How to count records in a Table or form

    I have a Table that went to my context in the form of ADOBE.  I need to be able to count the number of records in this table.  I didn't see the actual table in this case on the shape, I just need than the number of records.  And, I need to do this using JavaScript and I don't know anything about Java (although if FormCalc works I can use this as well).     My Tablename is a customer and in my form, it's in the hierarchy data .main .customerbody .customerline.  If I have to have these data in the table on the form, then I can just put it on the form and invisiible.  I really need to count the number of records well and return this # to a text field in the form.

    Does anyone know how to do this and can you give me an example is Java for FormCalc?  The more specific you can be with the example script best for this beginner.  THX!

    I was no longer complicate things, and I found a simple answer to my problem.  I do this on SAP with Livecyle form so here's what I did

    In the Interface, I created a global variable called gv_count.  I then added, during the initialization of form Interface, copy the following code:

    describe the table reservations LINES gv_count.

    And then, in the form, I had just to add gv_count to the context and how link this to the field I want to do the count

  • Count records in different tables with a condition

    Hello

    I would like to ask for your help. I want to count the records from multiple tables at the same time. These tables have a common column with them with a date data type. The output I want is to see the records in the tables with a condition of the column_date < (specified date).


    as of:

    Select count (*) from (the_tables) where (column_date), (specific_date)


    Your help would be much appreciated.

    Hello

    || ' WHERE ITEMDATE <= 8/1/2008;';
    

    With the Frank remark about the mistake, another good practice would be to use a connection variable:

    script_sql := 'SELECT COUNT (*) FROM '
    || r_1.owner
    || '.'
    || r_1.table_name
    || ' WHERE ITEMDATE <= :1';
    
    ...
    
    EXECUTE IMMEDIATE script_sql
    INTO this_cnt
    USING to_date('08/01/2008','DD/MM/YYYY');
    
  • Count records, the group, by order of

    Hi all

    I try to display the images 'top 5' downloaded from our site. I have attached the code with what I am currently working.

    Everything seems fine, except that I can't 'order by' the results of the count value "numImg".

    Any ideas?

    See you soon

    Trevor

    I found and implemented the following solution:


    Select strImage, count (strImage) as inputs to the Group of multimedia_feedback by order of count (strImage) DESC strImage

    Works a treat.

    See you soon

    Trevor

  • Count the number of records between two values of keys (BTREE)

    How can I count the number of keys between two values?

    I use python driver and BTREE access method.

    = >

    Ideally, what I want is a set of whole time series data (intervals may change) to a given number of points on average. The keys are timestamps and the values are the data that it takes on average. I need to count the number of records between two timestamps so that I can divide this figure by the number of points I need and data on average. What is the best way to do it?  Or should I keep the timestamp constant intervals and use the RECNO access method?

    Thank you
    (first post btw... and why is there not a lot of people at stackoverflow that answering the questions of Berkeley DB?)

    BDB is an integrated db and there no internal counters or statistics you might grap to use for this.    You will have to do it manually.

    You can create a cursor, grap the records you want, whenever you get the next card that you bump a counter.

    If you are using RECNO, you can use a slider to obtain the number of registration (DB_GET_RECNO), and if all that you data is in

    sequentail records with no missing documents, you can find the total number of take the last rec #-original rec # + 1 to get a count.

    If you pass the SQL API, you can issue a SQL query to give you a count.  Select count (*) where...

    As you enter the data anyway, so better perhaps to count records as you go along.

    Thank you

    Mike

  • How to count the records for each region day and conditional

    Hello

    I need to create a report where I list activities for a month and the number of specific Type for each days activities. something like below

    Number of days in the month where Type = 'A' Count where Type = B
    January 1, 2009 2 3
    January 2, 2009 7 6
    January 3, 2009 8 7
    ----

    -----
    January 31, 2009 4 6

    I tried with the creation of conditional region for each row of table for every day, but it does not work. I use below for conditional region-

    <? xdofx:If substr (to_date ('20': substr (Planned, 9, 2) |)) » -'|| substr (Planned, 1, 2). » -'|| (substr (Planned, 4, 2), 'MM-DD-YYYY'), 4, 2) = 01? > <? Planned? > <? end if? >
    But it is not functional and do not know how to count records in the table for each date as well.

    Can anyone help in it as soon as possible. I'm quite new to BI.

    Thnks

    You can mark it as resolved... :D

    Kind regards
    Colectionaru

  • Can I get the total number of records that meet the conditions of a query using the Table API?

    Hello

    A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.


    Can I get the total number of records directly meets the conditions of the query?

    I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.

    Can I get the same results using the Table API?

    I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.

    Hello

    Counting records in a database is a tricky thing.  Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained.  Such a count is a problem of performance in addition to competitive access problem.   The problem is even more difficult in a system widely distributed such a NoSQL database.

    The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation.  This is how you must do this within the API.  There is not a lot of code, but you have to write.  You certainly want to use TableIterator TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines.  Just one iteration and count.

    If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).

    Kind regards

    George

  • Query to count the values in a field

    I do the counts to the amount of entities in the database, I need to get the amount of registers for entities that appear

    Buenas, estoy trabajando Le con plsql there is me presenta a problema, Necesito UN count the amount of looking that returns the query por entity, estoy trabajando con UN procedure y evaluando don't con UN cursor, pero no be como hacer query trabajar para devolver ese valor homes


    GLOBAL ENTITY DATE TIME
    ======     =====     ====          ====
    ENT1 5 20100318 12:00
    ENT2 20 20100318 12:00
    ENT3 12 20100318 12:00

    CURSOR1
    SELECT distinct (rp.cod_entidad),
    YYYYYYYYY,
    TO_DATE (to_char (sysdate, 'YYYYMMDD'), 'YYYY-mm-DD') as fecha_pago,
    to_char(sysdate,'hh-mi-ss') as hora_pago
    REGISTRY PR, pc product
    where pc.nro_solicitud = rp.nro_solicitud
    and pc.resp_2 = 'OK '.
    and pc.resp_1 = 'OK '.

    Published by: 862673 on 31/05/2011 10:01

    Hello

    You don't want to then SEPARATE. Just use COUNT (*), which means "count records.

    Concerning
    Peter

  • Added a message when you save a record

    Hello world
    I have a button where I have the commig from the statement inside a trigger named when the Buttom pressed, but I want to add a message indicating the amount of documents that have been saved at the time where the forms commit files so that the user can see before their eyes.
    How can I do?

    Hello

    In the present code of message, the user may be able to see the amount of records that have been saved?

    You can count record thses u inserted in your loop in a variable with the help...

     MESSAGE('The amounts have been saved '|| SQL%ROWCOUNT || 'Recods Successfuly'  );
    

    The value of the ROWCOUNT % SQL fact attribute refers to the SQL statement executed more than PL/SQL in a cursor.

    To save a value attribute for later use, assign it to a local variable immediately.

    I hope this helps...

    Kind regards

    Abdetu...

  • ReadyNAS Pro 6 is stuck at the start...

    The ReadyNAS Pro 6 is running OS 6.4.1. It has 6 x 4TB Seagate disks and runs since sept 2013 OS6.

    1.5 weeks ago about the NAS got does not. The screen was black and did not respond to the power button. Also, there not respod on SMB, HTTPS or SSH application.

    I held the power button for a hard reset, the system was running from 21 to 24, then it's the same thing. I did a hard reset with the power button, but the system got stuck on Booting... I have powered the 25 and the start menu. I tried to run a test drive, he counted records (indicating the disk numbers) and has begun to rise 1%. The next morning the system still worked Testing (remember exact) just read on the screen.

    Now I tried to reinstall OS, but the system has been slain at the start... FW update (no figures for disks are displayed on the screen). I guess the next thing to try is the recovery from USB?

    Replied to your MP that you sent earlier this morning.

  • How to do the sync with notifier

    Hi all!

    Now what I'm trying to do is to do a sync. A series of signal keeps coming back, and a counter records the number.

    And I also have a data acquisition to output voltages. Now I want that whenever the meter changes, a change in the production of data acquisition

    could be triggered. A synchronization problem! I would like to ask for help on the implementation of this. To use a declarant or appearance? and how?

    Someone has an idea?

    Thank you!

    Chao

    The screws you have found would be used, but when you select create options from the file menu, one is open one of several models of design pattern.,

    When you select new, a dialog box opens where you can select what you want to open. In the hierarchical menu on the left, expand the 'VI' section and the section she titled "from the model. Continue downhill expanding 'Managers' and finally 'Design Patterns '.

    In this final section, you will find a model called "model design of producer/consumer (events)." Select it and then click OK.

    This model uses an event (in this case an event on a button to change value) to do something (cause a value to be put in a queue). This basic idea would be expanded by first returning 'upside down' and then using a user-defined event to transmit information of change of State between the loops.

    In this scenario, the loop at the bottom (which is where your data acquisition logic would be) becomes the producer loop while the top loop (the one with the structure of the event inside) serves as the loop of consumer.

    Basically, the counter in your code generates an event defined by the user whenever the value of the counter changes. The event would pass this state change information to the consumer (instead of a queue) loop.

    I make this change because the question you should address with the help of queues and notifiers to synchronize is that only the consumer will see any given notification or the queue item. It's the way they are designed to work and it can be a very useful feature, but if you have more than one consumer who needs to be informed of a change of State, it is also a problem.

    On the other hand, an event will be seen simultaneously by all consumers who have registered to receive. Similarly, an event can spend as little or as much as you want.

    Mike...

  • Extending from UIComponent - behavior FocusEvent

    Target: UIComponent is extended in a custom control and identify it receives and loses focus.  The contents of the control change depending on whether it has focus or not.

    Problem: with the following code, when the label of the control is clicked, the focus receives control and changes its content being displayed correctly.  However, when the second label is enabled, both labels become visible.

    Question: is there another way to create a custom control and dynamically vary the content based on its status?

    public class CCustomControl extends UIComponent
    {
        private var cntMain1:Container;
        private var cntMain2:Container;
    
        public function CCustomControl()
        {
            //*******************************
            cntMain1 = new Container();
            cntMain1.flow = ContainerFlow.VERTICAL;
            cntMain1.debugColor = 0x0000FF;
            cntMain1.setSize(300, 200);
            cntMain1.visible = true;
    
            var lblBeer:Label = new Label;
            lblBeer.text = "Beer is Good";
            lblBeer.autoSize = TextFieldAutoSize.CENTER;
            lblBeer.setSize(lblBeer.textField.width, lblBeer.textField.height);
    
            //*********************************
            cntMain2 = new Container();
            cntMain2.flow = ContainerFlow.VERTICAL;
            cntMain2.debugColor = 0x0FF00;
            cntMain2.setSize(300,200);
            cntMain2.visible = false;
    
            var lblSyrup:Label = new Label;
            lblSyrup.text = "Maple Syrup is Great";
            lblSyrup.autoSize = TextFieldAutoSize.CENTER;
            lblSyrup.setSize(lblSyrup.textField.width, lblSyrup.textField.height);
    
            //*********************************
    
            cntMain1.addChild(lblBeer);
            cntMain2.addChild(lblSyrup);
            this.addChild(cntMain1);
            this.addChild(cntMain2);
    
            this.addEventListener(FocusEvent.FOCUS_IN, GotFocus);
            this.addEventListener(FocusEvent.FOCUS_OUT, LostFocus);
    
            super();
        }
    
        private function GotFocus(e:FocusEvent):void{
            trace(TextField(e.target).text + " Got Clicked");
            cntMain1.visible = false;
            cntMain2.visible = true;
        }
    
        private function LostFocus(e:FocusEvent):void {
            trace(TextField(e.target).text + " Lost Focus");
            cntMain1.visible = true;
            cntMain2.visible = false;
        }
    }
    
    public class ContainerTest extends Sprite
    {
        public function ContainerTest()
        {
            var uiControl:CCustomControl = new CCustomControl();
            this.addChild(uiControl);
        }
    }
    

    Hey,.

    first of all, great thread format. Everything is super clear, formatted and buried on - Yes Bravo to that!

    as for your problem, from the looks of it you add both of the listeners to the UIComponent. whats happening is that the two events are triggered when you perform an action. in order to counter record, you can change your tune-up for this function:

    private function GotFocus(e:FocusEvent):void{    trace(TextField(e.target).text + " Got Clicked"); cntMain1.visible = !cntMain1.visible; cntMain2.visible = !cntMain2.visible;}
    
    private function LostFocus(e:FocusEvent):void {   trace(TextField(e.target).text + " Lost Focus");  cntMain1.visible = !cntMain1.visible; cntMain2.visible = !cntMain2.visible;}
    

    This will actually change visibility in front of what he was and is more compatible. hope that things cleared up. I'm a bit confused as the goal, but what I see, I think that's what you want to do. test out and hopefully it works for you. Good luck!

  • Group and County

    Hello friends,

    I have a question where I select the Organization, item_num and transaction_date.

    I need to group and count the result of transaction_date, so I have 3 groups:

    First - count records where transaction_date is located between the 1st and the 10th of the month.

    Second - will have records where transaction_date is located between the 11th and 20th of each month.

    Third - count records where transaction_date grave between 21 and 31 of the month.

    The result of this charge will be used in the Oracle report.

    Please, give me your advice on how I can get it.

    Thank you.

    Select the Organization,

    item_num,

    Count (case

    When transaction_date between trunc (transaction_date, 'mm') and trunc (transaction_date, 'mm') + 9 then 1

    end) "1-10"

    Count (case

    When transaction_date between trunc (transaction_date, 'mm') + 10, trunc (transaction_date, 'mm') and 19 then 1

    end) "11-20",.

    Count (case

    When transaction_date between trunc (transaction_date, 'mm') + 20 and trunc (last_day (sysdate)), 1

    end) '21-end '.

    FROM MyTable

    Group in the Organization, item_num

    ----

    Ramin Hashimzade

  • Return RefCursor function

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE 11.2.0.1.0 Production."
    AMT for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production


    Below the code successfully compiled.
      create or replace function emp_info_by_dept(p_deptno in scott.emp.deptno%type)
       return scott.emp%ROWTYPE
       as
       l_rec scott.emp%ROWTYPE;
       BEGIN
       select * INTO l_rec from scott.emp
       where deptno=emp_info_by_dept.p_deptno
       and rownum=1;
       return l_rec;
       end;
    How can I call call this function? When I use this function in a select as below
      select emp_info_by_dept(10) from dual;
    
    Getting error
    
    "ORA-06553: PLS-801: internal error [55018]
    06553. 00000 -  "PLS-%s: %s" "
    There are other ways to create a function with the return type using collections and procedures with updates like slider REF. But I want to know what's wrong with this function?

    Can someone explain to me please?


    Thank you
    SG

    >
    where can I include keyword LIMIT in select * BULK COLLECT... Statement?
    >
    Compare this example to my previous

    The FETCH does a BULK COLLECT of all data into 'v'. It will either get all the data or none if there isn't any.
    
    The LOOP construct would be used when you have a LIMIT clause so that Oracle would 'loop' back to
    get the next set of records. Run this example in the SCOTT schema and you will see how the LIMIT clause works.
    I have 14 records in my EMP table.
    
    DECLARE
      CURSOR c1 IS (SELECT * FROM emp);
      TYPE typ_tbl IS TABLE OF c1%rowtype;
      v typ_tbl;
    BEGIN
      OPEN c1;
      LOOP                                                 --Loop added
        FETCH c1 BULK COLLECT INTO v LIMIT 3; -- process 3 records at a time
            -- process the first 3 max records
           DBMS_OUTPUT.PUT_LINE('Processing ' || v.COUNT || ' records.');
            FOR i IN v.first..v.last LOOP
                DBMS_OUTPUT.PUT_LINE(v(i).empno);
            END LOOP;
        EXIT WHEN c1%NOTFOUND;
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('All done');
    END;
    
    In the FOR loop you would do any processing of the nested table you want to do
    and could use a FORALL to do an INSERT into another table.
    

Maybe you are looking for

  • How to set an automatic resizing on the new tabs in firefox?

    Rather than use the "zoom in" feature on each page, when I open a new tab, is there a setting that will change the defult page sizing?

  • LabView parks-McClellan FIR differentiator

    I am trying to create a parks-McClellan differentiating factor in LabView. I use the example of Math/optimization/FIR Optimization.vi as starting point. However, change the type of filter to differentiation of multiband to differentiator factor gives

  • F5 Refresh does not work

    Windows 7 IE9.  Refresh F5 is no longer (never made) work.  can someone help me.

  • How to fix the 2343 error in Vista

    When I try to install programs on it I get the message no install Error 2343 contributions. How can I fix this error in Vista Ultimate 64-bit

  • network coverage Info

    How to detect if the device has network coverage or not? the following Qt code does not work: Manager-> networkAccessible () == QNetworkAccessManager::NotAccessible is there an API specific BB10/stunts, we should use?