He had to find the percentage in the query

Dear experts,

This is the insert script

SELECT

(CASE WHEN process_code = 'ERROR HAUTH' THEN 'rejected by the question'

WHEN process_code = "PROCESSED" THEN "approved."

WHEN process_code = 'AUTH ERROR' THEN 'rejected by processor' END)

AS 'Instant Detail', COUNT (*) AS "count."

SUM (payment_amnt) AS 'total value.

(SUM (payment_amnt)) / 100 AS "percentage".

OF tran_log WHERE PROCESS_CODE IN('HAUTH ERROR','PROCESSED','AUTH ERROR')

GROUP BY process_code

Detail of the snapshotTotal numberTotal valuePercentage
Rejected by processor4341851291851.29
Approved519100064710006.47

Desired output

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

Detail of the snapshotTotal numberTotal valuePercentage
Rejected by processor43418512945.540
Approved519100064754.459

I want to apply this logic

Select 434 /(434+519) * 100 double ;---45.540

Select 519 /(434+519) * 100 double;--54.459

Help, please.

with dataset as

(

Select process_code, count (process_code) cnt, sum (payment_amt) total

of tran_log

Process_code group

)

Select process_code, sum (cnt), round ((sum (total) / sum (total) over()) * 100.2)

of the dataset

Process_code group, total

Union of all the

Select 'Total', sum (cnt), round ((sum (total) / sum (total)) * 100.2)

of the dataset

order of process_code

Tags: Database

Similar Questions

  • How can we find the query

    Hello

    As part of the optimization of performance,

    I want to find the query using pid is there any display.


    And the level of the os I received SUPERIOR command, using OS level pid can we find the query? HELLP me...

    Thank you
    Srini...

    Srini says:
    Hello

    As part of the optimization of performance,

    I want to find the query using pid is there any display.

    And the level of the os I received SUPERIOR command, using OS level pid can we find the query? HELLP me...

    Thank you
    Srini...

    As

    SQL>select s.sql_id,ss.sql_text from v$session s,v$process p,v$sqlarea ss where s.PADDR=p.ADDR and s.sql_id=ss.sql_id and p.SPID=18985;
    

    Where
    p.SPID = 18985 is your process id of the operating system.

  • Startup Repair... He had to find the product key

    Got a Vista computer that starts in the startup repair all the time no matter what, even in safe mode. I click on this pagehttp://grab.by/7Sse and nothing works to be able to reformat the computer.

    Fortunately, I got the Vista installation DVD, but the only problem is I cannot find the product key for it, is there an easy way to get it back? I live Linux disks so I can do it like that. I tried a few programs through wine and neither work.

    These are the programs I've tried under wine on Fedora:

    http://www.NirSoft.NET/utils/product_cd_key_viewer.html

    http://www.magicaljellybean.com/KeyFinder/

    Any help is appreciated in trying to extract the thanks :) product keys

    Hi Banjo348,

    Method 1: You can follow the steps mentioned in the article below and check if this solves the problem

    Windows Vista or Windows 7 unbootable and the Startup Repair tool does not resolve the problem
    http://support.Microsoft.com/kb/934540

    If the problem persists, contact the computer manufacturer

    About the product key, please see the article below

    How to identify, locate, and replace a product key
    http://support.Microsoft.com/kb/811224

    To replace a Microsoft product key, contact Microsoft and support Customer Service.
    http://support.Microsoft.com/default.aspx?scid=fh; EN-US; CNTACTMS

    Important note: This thread contains a reference to third party World Wide Web site. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there. There are the dangers inherent in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Thanks and greetings

    Ajay K

    Microsoft Answers Support Engineer
    ---------------------------------------------------------------------------------------------------------
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • We had to find the date in the format "DD-MM-YYYY" and "DD/MM/YYYY '.

    Hello world

    I need to find the hire_date in the format "dd-mm-yyyy" and "dd/mm/yyyy '. This shows also some errors, I can't found. pls help to solve this problem...

    Hello

    Christine Schnittker says:
    ... It works as well:

    SQL> select to_date('22-02-2012','dd/mm/yyyy') dt from dual;
    
    DT
    ----------
    22-02-2012
    

    (Does anyone know anything that actually says?)

    The Manual of the SQL language , after listing the format items allowed in TO_DATE, says the following:

    Any nonalphanumeric character is allowed to match punctuation characters in the format model. For example, the following statement returns no error:
    SELECT TO_CHAR (TO_DATE('02#07','MM/YY'), ' MM/YY') FROM DUAL;

    TO_CH
    -----
    02/07

  • How to find the query select bind variables

    How to extract the variable name to bind to AS suite of sql queries
    ' SELECT NAME IN: NAME OF THE DOUBLE '
    or
    "SELECT * FROM WHERE DOUBLE (: NAME = NAME)".
    or
    "SELECT * FROM WHERE DOUBLE: NAME IS NULL'."
    or
    "SELECT * FROM WHERE DOUBLE: NAME | NAME = LAST_NAME'
    or
    ' SELECT * FROM DUAL WHERE: a = 10'
    or
    "SELECT * from where DOUBLE: A > = 10'.
    or
    "SELECT * from where DOUBLE: A < = 10 '.

    Give a solution using SUBSTR, REGEXP_SUBSTR, please answer quickly
    best answer will be marked correct/good...

    Search: and then search for the following word breaker then have the substr for them: and the separator.
    You can build an own function to find the same.

  • I can't find the query option to scroll on the window of the effect

    Hi, I would like to use the motion of scrolling, but I can't find this option on the windows of the effect (see my screenshot). Can someone help me?

    The version of Muse is "Updated", I use a MacbookPro 13 the retina, with the Mavericks. Italian version of Muse

    Thank you

    Luca

    Schermata 2014-01-04 alle 22.16.42.png

    Schermata 2014-01-04 alle 22.16.59.png

    Hello Luca,

    You can find the "Scrolling Effects" option, as shown in this screenshot: http://screencast.com/t/kLI07niXE

    I hope this helps.

    See you soon

    Parikshit

  • He had to find the solution to the problem of its speaker after than IOS updated 9.3.2 update on the iPhone 6 s

    My wife and I have just updated our iPhones (his is a 6s, mine is a 6 s +) to IOS 9.3.2

    Mine works fine, but hers doesn't have a speaker sound.

    Works great with wired headphones or bluetooth headset connected, but no noise regular of the enclosure.

    Tried to reload, still no sound during playback of music, test different ringtones, nothing.

    Checked to make sure that all the settings are the same as on my 6s +. Both are basic 16 GB of memory.

    Is there a simple solution for now until the bug is fixed?  We are on the annual programme to upgrade with more of Applecare.

    Take a look at the following article: If you hear no sound or distorted sound of your iPhone, iPad or iPod touch speaker - Apple Support

    You mentioned some of the steps in your original post, but see what you haven't done yet.  Sometimes, Plug and unplug a pair of headphones sometimes solves the problem as well. -AJ

  • He had to find the way of the table based on conditions...

    Hello

    Please look at the specimen below...
     
    AMOUNT      ID NO             Date
              
    588     0000053125     07/01/09
    612     0000053125     06/01/09
    528     0000053125     05/01/09
    635     0000053125     04/01/09
    700     0000053125     04/02/09
    588     0000053126     07/01/09
    612     0000053126     06/01/09
    528     0000053126     05/01/09
    635     0000053126     04/01/09
    700     0000053126     04/02/09
    588     0000053127     07/01/09
    612     0000053127     06/01/09
    528     0000053127     05/01/09
    635     0000053127     04/01/09
    700     0000053127     04/02/09
    588     0000053128     07/01/09
    612     0000053128     06/01/09
    I need to know the average of (AMOUNT) of the last three months, based on the given ID no..
    Please note that for the registration of the sample, there are only 3 ID no.... but in real time will come more ID no..

    Note:
    ID no. 0000053128 is to have only two recordings... here, the average should be calculated accordingly.

    Hello!

    It should provide AVG ol 3 last records (assuming that you have in your data in a record for a month)

    SELECT id_no, AVG(amount)
       FROM (SELECT amount, id_no, date1, row_number() over(PARTITION BY id_no ORDER BY date1 DESC) rn
                    FROM Your_table ORDER BY id_no, date1 DESC )
    WHERE rn <= 3 GROUP BY id_no
    

    T

  • Find the query executed in webcenter content triggered from portal...


    Hello

    I want to see what query executed in webcenter content of the portal. How to see in the newspaper?

    1. connect to the administration Webcenter content Administrator console, navigate to Administration - "Audit Information System.

    2 'Sections Tracing Information' section, make a backup of the Sections "active."

    3. in the 'Active' chapters, add the new criteria:

    systemdatabase, search *, requestaudit

    4. Select 'Full Verbose', 'Save', then 'Refresh '.

    5. in the upper right corner, click on "View Server output" it will show the SQLs as below below.

  • Not able to find the query

    Dear all,

    I have a request from 10g to oracle HRMS attendance table.

    My requirement is that I need to get the latest information used without reducing the number of employees.

    A          B     C     D               E

    683162670.527/04/201527/04/2015
    691322612008/12/201531/08/2015
    69132361309/01/201509/03/2015
    70028661109/04/201509/04/2015

    Here's my query:

    Select min (date_start) leave_from, max (date_end) leave_to, to_number (sum (absence_days)) days

    of per_absence_attendances paba

    where paba.person_id =

    select (separate ppf.person_id

    of ppf, paf per_assignments_f per_people_f

    where ppf.person_id = paf.person_id

    and ppf.employee_number = '11190'

    )

    and date_end > = all (select date_start-1 in per_absence_attendances where person_id = paba.person_id)

    Output for the above query:

    09/01/201509/04/20154

    Here, I'm able to get the last 2 records, but my requirement is like a continuous vacation, I'm supposed to get the last 3 records.

    08/12/201509/04/201524

    Please can someone help me get this.

    Thank you

    with

    as example

    (select date ' 2014-12-01' date_from, date ' 2014-12-10' date_to of all the double union)

    Select date "2015-06-01,'date ' 2015 - 06 - 10 minutes of union double all the"

    Select date "2015-08-15', date ' 2015-08-31 the Union double all the"

    Select date "2015-09-01,'date ' 2015 - 09 - 10 minutes of union double all the"

    Select date "2015-09-11,'date '' 2015-09-11 of the double"

    )

    Select min (date_from) leave_from, max (date_to) leave_to, sum (days) days

    (select date_from, date_to, days,

    Sum (SOG) during grp (date_to order),

    Sum (SOG) on last_grp (order by date_to lines between unbounded preceding and following unbounded)

    from (select date_from, date_to, date_to - date_from + 1 days,

    -case when lag(date_to,1,date_from) (date_to layout order)! = date_from - 1

    then 1

    end from sog

    example

    )

    )

    where PRV = last_grp

    LEAVE_FROM LEAVE_TO DAYS
    15/08/2015 11/09/2015 28

    Concerning

    Etbin

  • Setting of the names of columns in the query in PivotChart

    Hi all

    I have columns for the wrong parameter names in a PivotChart query and I was wondering if someone could help me please understand me what I need to do.

    Help me help you, I have set up an example scenario in my hosted account. Here's the info to connect to my site hosted at [http://apex.oracle.com]
    Workspace: MYHOSTACCT
    Username : DEVUSER1
    Password : MYDEVACCT
    And here's my test request info:
    ID     : 42804
    Name   : dynamic query test
    Page   : 1
    Table 1: PROJECT_LIST         (Alias = PL...  Listing of Projects)
    Table 2: FISCAL_YEAR          (Alias = FY...  Lookup table for Fiscal Years)
    Table 3: PROJECT_FY           (Alias = PF...  Intersection table containing project fiscal years)
    Table 4: PROJECT_FY_HEADCOUNT (Alias = PFH... Intersection table containing headcount per project and fiscal year)
    Please forgive the excessive for this example standardization, as I wanted to keep the table structure similar to my actual application, that has a lot more going on.

    In my example, I have in the region to "Select the criteria", where the user specifies the project and the range of exercise that he or she would like to report. Click on the search button, and the report refers staff of revolving project for the range of the financial year.

    I've got it works using a query hardcoded, which is displayed in the region of the "hard-coded query." In this query, I have basically come back every year and to lay down the conditions on each column that determines if this column should be displayed or not according to the selected user. While this works, it is not ideal, because there could be several years more to take into account, and is not very dynamic. Any time an exercise is added to the table of FISCAL_YEAR, I update this page.

    So, after reading all the forums pivot OTN SQL and thread pivot "ask Tom", I was able to create a second region labeled "Dynamic motion" in which I created a dynamic query to return the same results. It of a much more intuitive solution and works very well; However, the column names are generic in the report.

    I had to put the query to analyze at runtime, because the list of column selection is dynamic, which violates the rules of SQL. Can someone help me please how can I specify my column names in the area of dynamic query to get the values of column even I receive in the region of hardcoded to understand?

    Please let me know if you need more information and thanks a lot in advance!

    Mark

    Take a look at your request now. I added a function in your workspace, change the headers to be pl/sql base, added an element hidden to contain the query you create and pass in the service to get your item headers...

    Thank you

    Tony Miller
    Webster, TX

    On the road of life... He has "windshield", and there are "bugs".
    (splat!)
    "Squeegees wanted."

    If you answer this question, please mark the thread as closed and give points where won...

  • necessary logic in the query

    Hi Expert,

    I use under query mentioned I join two table but in the second table cclean.vm_cellc_postal_address b I must add one more on condition that
    If con b.street code is 3 digit as 123 and then add the prefix 0 (AND TRIM (a.post_code) = TRIM (b.street_code) ;)


    SELECT a.address_id AS address_id,
    a.Line_1 AS line_1
    a.City CITY,
    b.Town CITY,
    a.State AS State,
    SUBSTR (b.province, 0, LENGTH (b.province) - 1) AS a province.
    a.clean_status as clean_status,
    b.street_code
    FROM (SELECT ah.address_id, ah.suburb, ah.line_1, ah.city,
    Ah.post_code, ah.state, ah.country, ah.clean_status
    OF cclean.vm_processed_address_history ah
    WHERE ah.suburb IS NOT NULL
    AND ah.post_code IS NOT NULL
    AND SYSDATE BETWEEN ah.effective_start_date
    AND ah.effective_end_date
    AND ah.suburb IS NOT NULL
    AND ah.post_code IS NOT NULL
    AND NVL (UPPER (ah.clean_status), 'NONE') <>'
    AND (UPSTAIRS (line_1) NOT AS 'PRIVATE BAG % %')
    AND SUPERIOR (line_1) NOT LIKE '%p % % BOX.
    )) a,
    cclean.vm_cellc_postal_address b
    WHERE TRIM (UPPER (a.suburb)) = TRIM (UPPER (b.suburb))
    AND (TRIM (UPPER (NVL (a.city, 'dummy_value'))) <>
    TRIM (UPPER (b.town))
    OR GARNISH <>(UPPER (NVL (a.state, 'dummy_value')))
    TRIM (UPPER (SUBSTR (b.province, 0, LENGTH (b.province) - 1)))
    )
    AND TRIM (a.post_code) = TRIM (b.street_code);

    You can use the logic in where condition but not sure about the performance. In any case find the query below with logic

    SELECT a.address_id AS address_id,
    a.Line_1 AS line_1
    a.City CITY,
    b.Town CITY,
    a.State AS State,
    SUBSTR (b.province, 0, LENGTH (b.province) - 1) AS a province.
    a.clean_status as clean_status,
    b.street_code
    FROM (SELECT ah.address_id, ah.suburb, ah.line_1, ah.city,
    Ah.post_code, ah.state, ah.country, ah.clean_status
    OF cclean.vm_processed_address_history ah
    WHERE ah.suburb IS NOT NULL
    AND ah.post_code IS NOT NULL
    AND SYSDATE BETWEEN ah.effective_start_date
    AND ah.effective_end_date
    AND ah.suburb IS NOT NULL
    AND ah.post_code IS NOT NULL
    AND NVL (UPPER (ah.clean_status), 'NONE') '
    AND (UPSTAIRS (line_1) NOT AS 'PRIVATE BAG % %')
    AND SUPERIOR (line_1) NOT LIKE '%p % % BOX.
    )) a,
    cclean.vm_cellc_postal_address b
    WHERE TRIM (UPPER (a.suburb)) = TRIM (UPPER (b.suburb))
    AND (TRIM (UPPER (NVL (a.city, 'dummy_value')))
    TRIM (UPPER (b.town))
    OR CUT (UPPER (NVL (a.state, 'dummy_value')))
    TRIM (UPPER (SUBSTR (b.province, 0, LENGTH (b.province) - 1)))
    )
    AND decode (length (TRIM (a.post_code)), 3, '0' |) TRIM (a.post_code), TRIM (a.post_code)) = TRIM (b.street_code);

  • my iphone 6s is stolen I had activated find my iphone, but now the device does not appear on my icloud find my iphone please suggest what to do.

    my iphone 6s is stolen I had activated find my iphone, but now the device does not appear on my icloud find my iphone please suggest what to do.

    If your iPhone, iPad or iPod touch is lost or stolen - Apple supports

  • Why firefox free version 29.0.1. It's terrible! I had to find a plugin to change the back legs. Bad decision. Why this was done?

    Why firefox free version 29.0.1. It's terrible! I had to find a plugin to change the back legs. Bad decision. Why this was done?
    Not happy with the version 29.0.1 - are there plans for this move?

    Hi RickAce

    Could you please start a new thread for your question?

    You can provide more information such as your operating system and installed extensions and plugins installed.

    In case of accidents also please add a few recent crash ID that you can find on the subject: page hangs and which begin with a prefix 'bp '.

    You can check for problems with the files that store the preferences.

    Delete a possible user.js file and files numbered prefs-# .js and rename (or delete) the file prefs.js to reset all the prefs by default, including the prefs set via user.js and pref which is no longer supported in the current version of Firefox.

  • I just started using my new iMac 27 "and in Mail, I can't find the setting to display a column that shows the number of emails in each folder.  Mavericks, I had this column.  I have checked all the menus and preferences and search online.

    I just started using my new iMac 27 "and in Mail, I can't find the setting to display a column that shows the number of emails in each folder.  Mavericks, I had this column.  I have checked all the menus and preferences and search online.

    Click the triangle next to the Inbox to view the Inbox for each account. Then select the desired mailbox and the information will be displayed in the upper part.

    You are entitled to 90 days telephone support from Apple. Try to contact them.

    Apple Support contact

    Apple Support by email or chat

    Contact Apple Support - phone

Maybe you are looking for