Number of records

I have a table in which the fields are statename, voucher_no, amount, status


I want an output where I should get statename, County of good assets, sum of the amount of good assets, County of idle good, sum of the amount of inactive checks, expired checks count, sum of the amount of the cheques obsolete


for each State

in this table, there are different status as active, inactive, expired, etc.

Hello

You can try this (untested):

select  statname,
        sum(cnt_active) cnt_active, sum(sum_active) sum_active,
        sum(cnt_active) cnt_inactive, sum(sum_active) sum_inactive,
        sum(cnt_active) cnt_expired, sum(sum_active) sum_expired
from (
    select statname,
           decode (status, 'ACTIVE',1,0) cnt_active,
           decode (status, 'ACTIVE',amount, 0) sum_active,
           decode (status, 'INACTIVE',1,0) cnt_inactive,
           decode (status, 'INACTIVE',amount, 0) sum_inactive,
           decode (status, 'EXPIRED',1,0) cnt_expired,
           decode (status, 'EXPIRED',amount, 0) sum_expired
    from your_table
) group by statname;
       

Kind regards
Sylvie

Tags: Database

Similar Questions

  • Can Notes show the number of records with each folder?

    Can Notes show the number of records with each folder?

    No it can't. It would be nice tho.

  • Copy from HDD to disc results external hard of different sizes but the same number of records

    Backup hard drive to external drive, 800 GB in total. When finished copying the file on the external drive size is smaller than 40 GB, but there is the same number of records.

    Different disks often present of thisdue fragmentation on each disk and the differences in the block sizes used on each disc. As long as all your data are present then there is no need to worry.

  • Electric trigger DAMA IQ & check for new records to collect an infinite number of records

    Hi all

    I have some difficulties with the help of the trigger edge power IQ & questioning the DAMA if it has samples/records ready for pick up.  I have reviewed the documentation on the support to the screw and the examples provided with the driver of the ACCA and have not been able to solve my problem on my own.    What I'm trying to do, is to have this VI capture periodic RF bursts that are larger than a specified threshold.

    I go to this topic in the following way:

    I put the number of samples I captured (finished) for each burst which crosses the threshold
    I put the number of records to capture to be infinite
    I said that the rising slope and the appropriate threshold
    I have then to validate the configuration of the ACCA and start acquiring
    I have then go into a loop and check the backlog of samples as well as the acquisition is
    If either of the above is true then I get the samples with the IQ extract complex WDT vi
    I continue looping until the user stops the vi with a button on the front panel
    I went on this path that I didn't block indefinitely or for long periods of time

    What I see is:

    I'll take one shot and then nothing else
    what the samples never back above zero
    that acquisition is ever complete
    If I switch out the IQ extraction with equivalent IQ reading and ignore the completion back & I get documents like I expect

    My understanding is as follows:

    Electric trigger IQ does not have to be re-armed in VI
    that each trigger to fire IQ Power will create a new record containing the number of samples that I asked

    My questions:

    It seems that when the number of records is infinite that the acquisition is never considered as carried out when the State of the acquisition is verified, is that correct?
    I receive multiple records pending upward on the ASB using this configuration?
    Why a record number is provided with the back of fetch get VI?
    Why would I pick any folder, but the record of zero?
    I'm doing something wrong here?
    Is there a better way to do this?
        
    Thank you
    Russell

    Hi Russell,

    You are on the right track to get your application do what you want. Instead of check to fetch back, I suggest that lets you read the property node DAMA the "' Acquisition > Fetch > Records made" property to know when a new record was acquired. "

    > it seems that when the number of records is infinite that the acquisition is never considered as carried out when the State of the acquisition is verified, is that correct?

    That is right.

    > I get multiple records pending upward on the ASB using this configuration?

    Yes

    > Why a record number is equipped with the rear of fetch get VI?
    > Why would I pick any folder, but the record of zero?

    You ask DAA for an infinite number of records. File 0 started the first trigger seen. Record 1 to the second outbreak (end of disk 0) and so on.

  • Unable to get the total number of records processed by the processor of trade rules

    Details of the environment

    ======================

    Disqualification Version: 12.1.3.0.0


    I use a business rules processor to implement multiple business rules on one record and I am looking for a summary of the number of records increased and does not have a specific rule.


    To illustrate:
    Suppose there are 2 rules, invalid number in Column1 and valid number on Column2.
    10 records to process and 3 folders don't rule 1 (valid on column1) and 9 entered failure of rule 2 (valid number on Column2).

    In the browser of result of the processor Business, the number of past records and failed is displayed but is not part of the output of the processor itself. In the example above, there will be 1 pass and 9 fail records and given the values of said the total number of records can be derived which is 10.

    This is why the expected output will be:
    Success of failure
    Rule 1:7 (10-3) 3
    Rule 2: 1 (10-1) 9
    Note: The number of records that failed can be derived from the table of the rule ID but I don't know how to get the total number of records in order to calculate the number of records that a given rule.

    I tried to publish the County of acceptance and rejection in the browser of result of the processor Business in an intermediate table and ask the same intermediate table to get the pass and fail values but Disqualification does not allow to write and read the same intermediary object in a single process. What is the best way to get the number of records total handled by the processor business rules? This kind of attributes (that do not exist only in the browser of result) can be included in the output of the processor in the next version of the Disqualification?

    In addition, the intermediate table contains only 1 sheet with pass and failure values while the exceptions which have individual failure on each rule contains 12 Archives. What would be the best approach to merge a single record into multiple records according to the example below?

    Staging table
    Success of failure
    1 9

    Exception table
    Single ID ID rule
    Rule 1 Record1
    Rule 1 Record2
    Rule 1 record Record3
    Rule 2 Record1

    Exception table with: staging Table data merge
    Rule ID ID Unique Pass Fail Total
    Rule 1 1 9 10 Record1
    Rule 1 1 9 10 Record2
    Recording rule 1 Record3 1 9 10
    Record1 rule 2 1 9 10

    Please notify.

    Hi Jason,

    The best way to explain how to do this is with an example project (DXI). I'll send you one in offline mode.

    -Mike

  • Does Oracle 10g - Record Count/Total number of records.

    Hello, I'm looking to display the current records of number / total Records at the bottom left of a custom form. Please see below, made me know how this is done. Enjoy it!

    record_count.jpg

    Thanks, Naveen.

    Your question is unclear.  Forms already did what you mentioned and appears as such in the image you downloaded.  If you don't see it in a particular form, open the form in the report generator and check at the level of the 'form', property 'The Console window' is not NULL and properly reflects the name of the appropriate window.  A NULL value prevents the message bar appears.

  • How to determine the number of records in a subquery

    I am fairly new to Oracle SQL, and would like to know if anyone has examples of how to perform the following operations:

    1. I would return the number of rows that exist in the following SQL statement below. This SQL will be part of a larger SQL statement and I will be passing in the EMPLID identifier in the subquery. The result must be a value showing the total number of records that correspond to the SQL below. "xyz" will be finally passing through the extension number of the employee by using a reference to the parent SQL... ie: jbe. POSITION_NBR
    2. My SQL:

    SELECT Cjbe. EMPLID OF PS_JOB cjbe
    WHERE cjbe. POSITION_NBR = "xyz".
    GROUP BY cjbe. EMPLID

    I would like to know how I can change the value of poarent to POSITION_NBR (I think I use jbe.) POSITION_NBR) total calls the EMPLID found in this subquery subquery and then return.

    Thanks for your help.

    Maybe I lack something, but isn't this just

    SELECT count (distinct empl_id) from ps_job where position_nbr =: some_position_nbr

  • How can I recover only odd or even number of records in the table?

    Hello

    How can I recover only odd or even number of records in the table?

    Thank you

    Hi IndiMinds,

    Alternatively, you can use in queries. :

    Odd:

    SELECT *.

    Of

    (SELECT rownum row_count, id, name FROM bigemp

    )

    WHERE mod (row_count, 2) = 1;

    Still:

    SELECT *.

    Of

    (SELECT rownum row_count, id, name FROM bigemp

    )

    WHERE mod (row_count, 2) = 0;

    Thank you

  • 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

  • difference in number of records in the table of audit

    Hi all

    We strive to remove lines of verification based on timestamp(sysdate-30) table(sys.aud$). The command I used below.

    SQL > set lines 200

    COL OWNER FORMAT A15

    Select TABLE_NAME, nom_tablespace, OWNER, num_rows, STATUS, DEGREE, TABLE_LOCK, LAST_ANALYZED, PARTITIONED, USER_STATS from dba_tables where TABLE_NAME = '& TABLE_NAME';

    SQL > SQL > type table_name value: AUD$

    OWNER, TABLE_NAME, NUM_ROWS STATUS DEGREE TABLE_LO LAST_ANALY BY USING NOM_TABLESPACE

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

    SYS AUD$ 934991 SYSTEM VALID ACTIVE 1 08/07/2012 No. No.

    SQL > delete / * + parallel (aud$ 8) * / of sys.aud$ where NTIMESTAMP # < sysdate-30; (I don't know why I put NTIMESTAMP #, although I see # aud TIMESTAMP column $ table, the above query, I got from sr dba)

    3140994 deleted rows. (reason why so many records have been deleted I see 934991 lines from dba_tables view)


    After that I saw the difference in number of records.


    SQL > select / * + parallel (aud$ 8) * / count (*) from sys.aud$ where TIMESTAMP # < sysdate-30;

    COUNT (*)

    ----------

    0

    SQL > select / * + parallel (aud$ 8) * / count (*) from sys.aud$ where NTIMESTAMP # < sysdate-30; -> Why there are differences in the number of records if I put NTIMESTAMP #in query)


    COUNT (*)

    ----------

    50

    Thank you

    Bhavani.

    SQL > SELECT count (*) from sys.aud$ where ntimestamp #.<>

    COUNT (*)
    ----------
    0

    Try this one.  Good luck.

  • I can capture the number of records retrieved by page in the Apex Interactive report?

    Hello

    I have a requirement in which I need to conditionally hide / show button on an interactive report.

    To achieve this, I need to compare the number of reows read by v/s lines page number to be

    read as specified by the user (defined using Actions-> lines per page).

    Please help me to know if there is a way to capture these 2 values:

    1. number of records retrieved in a report by page

    2. the value set by the user for the number of rows must be extracted (Actions--> lines per page).

    Quick help is really appreciated. Thank you.

    Hello

    You can use by jariola in his blog

    http://dbswh.webhop.NET/Apex/f?p=blog:read:0:article:41900346848694

    Thank you

    Benjamin

  • number of records displayed

    Hi all

    I have a report, each page has a number of records, but there is a space at the bottom of the page,

    I want to fill this space with records? How to do?

    How maximiza the number of records displayed?

    I tried the property of "maximum entries displayed" the extensible framework, but in vain,

    When I try 15 works, it shows 15 records, but when I try 30, it displays over 15 discs but not 30?

    Why?

    Thanks in advance

    Thank you

    the problem is that the margin should be extended to the bottom of the page.

    and by replacing the portrait report

  • ADF table large number of records

    JDeveloper 12.1.2

    I have an engine of research as well as an array of result. In some research, it is possible that the result set is more than a million records. The problem is when the user uses the table scroll bar and quickly tries to go at the end of the result set, weblogic with error, memory, it blocks. What is the best practice to handle this in the user interface?

    I think of several ways to resolve and would like if anyone has experience with one of the following:

    1. when the user performs the search, run select count (*), and determine the number of records search will return. If say greater then 1000, warn the user to refine the search criteria. This seems to have made an extra trip to DB

    2. implementation of the pagination of the table instead of the scroll bar. Is this possible in the last ADF table?

    3. go to the front and back only to say 1,000 records and warn the user that not all records are returned, and that it would be best to refine the criteria. Similar to 1, except no extra trip to DB

    Thanks in advance for comments and maybe the solution

    Insufficient memory is caused by the underlying ViewObject that retrieves and keeps track of all the lines to the position where the user scrolls to the bottom of the table. It is behavior of the VO when the VO is configured with the access mode "Scrollable", which is the default access mode setting. For example, if the user scrolls to the No.100000 line, the VO to get and keep in mind all the lines n ° 1 to No.100000. This means that the table pagination will NOT help you!

    Fortunately, you have two simple options out-of-the-box:

    1. The 1st option is to configure the original Version of extraction does not exceed a fixed number of lines (for example 5000). You can do it in the "General" of the VO definition dialog page. Go to the 'Tuning' section, select the option "only up to line number" and enter the number chosen in the field of text next to it. In this way, what the condition is entered by the user, the VO will seek no more than the specified line number.
    2. The 2nd option is to configure the VO with "Range Paging" access mode rather than the default access mode "Scrollable". With the access mode "Range Paging" the VO not go get and keep in mind all the lines until the currently selected line, but he keeps in memory a few line ranges (for example only a few dozen lines). This way you will not be affected by an OutOfMemory error even if the user scroll down to a millionth line. The downside is that when it is configured with "Range Paging" the VO will have to rerun the query each time when he needs to pick a different range of lines. If the execution of the query is slow to the DB server, this will load the DB server and the user will experience delays when scrolling in a different range of lines.
      Take a look at the documentation for more details here: View object performance tuning (read article 9.1.5).

    Dimitar

    Post edited by: Dimitar Dimitrov

    If you decide to use "Range Paging", don't forget to set the appropriate size, which is not less than the usual number of visible lines in your table on the page. If you set the size of the lower range, then the original Version will have to fetch more than a range of lines, which will need more of a running query. The size of default in the definition of VO is 1, but it is not important. The important value is the size of the range that is defined in the iterator binding in the PageDef, which overrides the setting of the VO. The default value for the size of the links of the iterator range is 25.

  • Returns the number of records

    IM under the sub query, it returns the number of records, but how can I count the number of records is reurning?

    I use version 12.0.0.61 (toad for oracle)

    Thank you

    Select * from object

    where owner = 'FIRST '.

    AND OBJECT_TYPE = 'FUNCTION '.

    AND OBJECT_NAME LIKE '% FDR_ % '.

    If you want just the County

    select count(*)
      from all_objects
     where owner='PREMIER'
      AND OBJECT_TYPE='FUNCTION'
      AND OBJECT_NAME LIKE'%FDR_%'
    

    If you want the number on each line in addition to the line-level data

    select a.*, count(*) over () cnt
      from all_objects a
     where owner='PREMIER'
      AND OBJECT_TYPE='FUNCTION'
      AND OBJECT_NAME LIKE'%FDR_%'
    

    Justin

  • good way to get the number of records in a block

    Work with form 11g.

    I want to know the amount of files that are currently in a block, being that the : system.cursor_record you could get if you issue a built-in last_record .

    It's the kind of thing that should be easy to get with a get_block_property, but I looked for the property and I have not found.

    There are various fo get_block_property properties that relate the number of records, but none seems to fit what I need. The best is QUERY_HITS. It works great when you run just a query (showing all records), but if you add or delete records, it retains its old value, so it doesn't help.

    The trick of last_record is very dirty (and implies the navigation, which is worse)... Can you think of something better?

    I tried with a glimpse at the point and it works, but I don't know if it's reliable, and it is still too expensive for something that should be in a property

    My advice would also be the preview to the point

  • 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

Maybe you are looking for

  • Charged for something I didn't buy

    Hello I received a bill for: Sing! Karaoke by Smule, subscription VIP (automatic renewal)Monthly | August 31, 2016Report a problem In-App purchase £29,94 I didn't buy it, and when I go to the link to cancel my malware checker stops at the opening pag

  • Removal of the photo library

    Once a library photo system was chosen. I'm able to remove other libraries of Photos?

  • New MacBook Pro Release - 2016

    I had a PC guy since I started to use computers and a few years ago I bought an iPad and iPhone. I always wanted to buy an Apple computer, but it was too expensive. Given the quality of Apple products, and how the OSX is good, I finally want to inves

  • Windows XP - my view of the Office is too big, my icons too

    Original title: Hello Hello.My Office view is too large, my icons too... and when I open my browser it looks great new... How can I do normal display? thnx

  • How to get personal files on a backup external hard drive for windows 7

    How to get files from a backup external hard drive for windows 7 pro. ? I DON'T WANT TO RESTORE WINDOWS 7, JUST MY PHOTOS & DOCUMENTS.    TO THANK THE TAXI 53 DRIVER