sum of the value group by type, in different columns

Hello

I have a table to store employees leave

I want to get the sum of the minutes of leave for each employee for each leavedate in two columns, "COFFminutes" and "otherleavesminutes".

one is the sum of the minutes to leave the COFF type for a particular day to a particular employee.

Another is the sum of all the other sheets for a particular day to a particular employee.


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

LEAVE

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

EmpIDleavefromleavetoleavetype
101/01/14-08:0001/01/14-16:00CL
101/03/14 08:0001/03/14 12:00CL
101/03/14 14:0001/03/14 16:00COFF
124/01/14-08:0024/01/14 12:00CL
124/01/14 12:0024/08/14-13:00LLP
201/08/14-08:0001/08/14-16:00CL
201/10/14 08:0001/10/14 12:00CL
201/03/14 13:0001/03/14 15:00COFF
220/01/14-08:0020/01/14 12:00CL
220/01/14 12:0020/08/14-16:00COFF

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

Power required

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

EmpIDDateCOFFminutesotherleavesminutes
101/01/140480
101/03/14120240
124/01/1460240
201/08/140480
201/10/140240
201/03/141200
220/01/14240240

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

Is this possible?

Help, please...

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

NOTE

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

I use oracle 10 g

Leave period will not be credited to another day.leave of and permission will be held the same day.

examples of data

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

create table leave as

(

Select empid, 'CL' 1 as leavetype, to_date (08 January 1 2014:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (1 January 2014 16:00 ',' DD/MM/YYYY HH24 ') as leaveto of union double all the

Select empid, 'CL' 1 as leavetype, to_date (2014:00 1 March 08 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (March 1, 2014 12:00 ',' DD/MM/YYYY HH24 ') as leaveto of all the double union

Select empid, 'COFF' 1 as leavetype, to_date (March 1, 2014 14:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (March 1, 2014 16:00 ',' DD/MM/YYYY HH24 ') as leaveto of union double all the

Select 1 as empid, 'CL' leavetype, to_date (08 24 January 2014:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (January 24, 2014 12:00 ',' DD/MM/YYYY HH24 ') as leaveto of union double all the

Select 1 as empid, 'LLP' leavetype, to_date (January 24, 2014 12:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (13 24 January 2014:00 ',' DD/MM/YYYY HH24 ') as leaveto of union double all the

Select empid, 'CL' 2 as leavetype, to_date (08 August 1 2014:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (August 1, 2014 16:00 ',' DD/MM/YYYY HH24 ') as leaveto of all the double union

Select empid, 'CL' 2 as leavetype, to_date (08 October 1 2014:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (October 1, 2014 12:00 ',' DD/MM/YYYY HH24 ') as leaveto of all the double union

Select empid, 'COFF' 2 as leavetype, to_date (March 1, 2014 13:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (March 1, 2014 15:00 ',' DD/MM/YYYY HH24 ') as leaveto of union double all the

Select empid, 'CL' 2 as leavetype, to_date (08 January 20 2014:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (January 20, 2014 12:00 ',' DD/MM/YYYY HH24 ') as leaveto of union double all the

Select empid, 'COFF' 2 as leavetype, to_date (January 20, 2014 12:00 ',' DD/MM/YYYY HH24 ') as leavefrom, to_date (16 January 2014:00 20 ',' DD/MM/YYYY HH24 ') as leaveto of the double

)

Hey,.

Here you go with the solution:

SELECT EMPID, DAT, SUM (NVL(COFF_minutes,0)) COFF_minutes, SUM (NVL(other_leaves_minutes,0)) other_leaves_minutes

DE)

SELECT EMPID, TRUNC (LEAVEFROM) DAT,

(CASE WHEN LEAVETYPE = 'COFF' THEN (LEAVETO-LEAVEFROM) * 24 * 60 END) COFF_minutes,

(CASE WHEN LEAVETYPE <> 'COFF' THEN (LEAVETO-LEAVEFROM) * 24 * 60 END) other_leaves_minutes

ANNUAL LEAVE

)

GROUP OF EMPID, DAT

ORDER BY EMPID, DAT

Thank you

Govind

Tags: Database

Similar Questions

  • sum of the values in a row

    Hello

    I have a table table1 with the columns a, b, c and d

    I get some results this table using this query:

    SELECT
    a,
    b,
    sum (case when c = 'F' then '1' other '0' end) 'c_data. "
    sum (case when d = s 'then ' 1' other end '0') "d_data".
    Of
    Table1:
    WHERE
    a = 'a value '.
    GROUP BY
    b

    My result will be like this:
    a d_data of c_data to b
    ABCD efg 1 1
    Fund fjd 1 0
    DFD fd 0 0

    Now I need a 5th column, which should look like this: -.
    a b c_data d_data Total
    ABCD efg 1 1 2
    Fund 1 0 1 fjd
    DFD fd 0 0 0

    Please someone change and give me the above query?

    Double wire.
    sum of the values in a row

    Please close.

  • SQL query to display the sum of the values of each June and December

    Hello having problems of construction of a query to the list SQL query to display the sum of the values of each June and December each year.

    My Table;

    TABLE name: MONTH_TERM

    Fields with values:

    TERM_KEYMONTH_ACTUALMONTH_DATE
    8250001/11/2015 0:00
    8245001/12/2015 0:00
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:00
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:00
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    What I would like to see in a query result:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/2015 0:00
    8245001/12/2015 0:00950
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:002525
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:002658
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    ---

    Here's my query:

    Select

    "TERM_KEY,"

    "MONTH_ACTUAL,"

    to_char(MONTH_DATE,'MM/YYYY') MONTH_DATE,

    DEAL to_char (MONTH_DATE, 'MM')

    WHEN '06' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 1 and 6

    AND term_key = 82)

    WHEN '12' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 7 and 12

    AND term_key = 82)

    ELSE null

    END as SIX_MO_CUMM,

    of MONTH_TERM

    where term_key = 82

    It's my results:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/15 0:00
    8245001/12/15 0:003608
    8240501/01/16 0:00
    8240001/02/16 0:00
    8245001/03/16 0:00
    8242501/04/16 0:00
    8243501/05/16 0:00
    8241001/06/16 0:003717
    8240901/07/16 0:00
    8241501/08/16 0:00
    8242001/09/16 0:00
    8242210/01/16 0:00
    8243601/11/16 0:00
    8255601/12/16 0:003608
    8256801/01/17 0:00
    8262401/02/17 0:00

    Any ideas on how to fix would be great

    Select term_key,

    month_actual,

    month_date,

    case mod (to_char (month_date, 'mm'), 6)

    When 0 then sum (month_actual)

    During)

    term_key partition

    order of month_date

    between the previous month '5' interval and the current line

    )

    end '6 MONTHS in TOTAL'

    from tbl

    order of term_key,

    month_date

    /

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 500 NOVEMBER 1ST, 15TH
    82 450 1 DECEMBER 15 950
    82 405 1 JANUARY 16
    82 400 1 FEBRUARY 16
    82 450 1ST MARCH 16
    82 425 1ST APRIL 16
    82 435 1 MAY 16
    82 410 2525 1 JUNE 16
    82 409 1 JULY 16
    82 415 1ST AUGUST 16
    82 420 16 - SEP - 01

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 422 1 OCTOBER 16
    82-436 NOVEMBER 1, 16
    82 556 2658 1 DECEMBER 16
    82 568 1 JANUARY 17
    82 624 1 FEBRUARY 17

    16 selected lines.

    SQL >

    SY.

  • dynamic sum of the values entered into the Web page

    Hello

    I have a question I want to display the total sum of the values entered in the web page

    Suppose I have 3 fields

    If I enter 10 in the first field, it should consider other value two field 0

    and it prints the 10 in total value.

    next register 15 in the second field, then he cosiders 3rd classified is 0 and altogether it prints 25

    like that, I want to display the total values whenever the user enters the value in the textfield

    Hi all

    I found the solution to this blog

    Blog of Anil Oracle Application Framework: Dynamics for summation in advanced table

  • To have the value 'All' in the list of elements of control in the value of array type

    Hi all

    To have the value 'All' in the list of master points.
    Need to create a set of value that shows the items in the inventory template and append the value 'All' in the list, so that the user can select.

    I have the below query that does this. But how can I highlight the value of table type.

    SELECT ItemList segment1
    OF MTL_SYSTEM_ITEMS_B
    WHERE organization_id = 0
    UNION ALL
    SELECT 'All' ItemList
    OF the double

    Please do the needful.

    Thank you.

    Hello
    One way to do, is to create a database for you view query and base your value set on this point of view.
    Hope this helps,
    J.

  • Set the value of a checkbox in a column of a tree control

    Hello

    I couldn't ' find the feature set/get the value of a checkbox in a column of a tree control.

    Thank you for your help

    Bertrand

    Hi Bertrand, this discussion should help you in this task.

  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • Dynamically update a numeric field as the sum of the values of page element.

    Hello

    I am updating a numeric field on a page of the apex by summing the values of several components of the page. I have tried to follow this tutorial http://st-curriculum.oracle.com/obe/db/apex/r40/apexdynactions/apexdynactions_ll.htm, especially the part "create a Set value dynamic Action with the help of PL/SQL'.

    In the example of the tutorial, they return a value of page element P3_SAL multiplied by a multiplier determined by the case of another page. What I want to do is much more simple that I just want to add multiple values page element and then display them in a numeric field at the bottom of the page.

    so the code I tried to use based on the tutorial is in the tab: Home > Application Builder > Application 103 > Page 3 > Dynamic Action change > create / edit Action

    Set type: PL/SQL function body

    PL/SQL function body:

    BEGIN
    return: P3_ITEM1 + P3_ITEM2 + P3_ITEM3;
    END;

    Page items to submit: P3_ITEM1, P3_ITEM2, P3_ITEM3

    But it gives me an error that I need to declare identifiers, and yet it works if I use only one article and I can perform arithmetic.

    That is to say.

    BEGIN
    return: P3_ITEM1 + 1000;
    END;

    Any help would be appreciated.

    PL/SQL function body:

    BEGIN
    return: P3_ITEM1 + P3_ITEM2 + P3_ITEM3;
    END;

    Page items to submit: P3_ITEM1, P3_ITEM2, P3_ITEM3

    But it gives me an error that I need to declare identifiers, and yet it works if I use only one article and I can perform arithmetic.

    In your code, it lacks the ":" for articles P3_ITEM2 and P3_ITEM3.
    Try this:

    BEGIN
    return :P3_ITEM1+:P3_ITEM2+:P3_ITEM3;
    END;
    
  • Returns the sum of the values of certain months

    Hello

    I have a table that I keep a record of my overtime. See below.

    I want to do another table of the month (Jan, Feb, Mar etc.) and next to it the sum of all overtime worked each month.

    My salary is developed from the 4th of each month to the 4th on the other, I am able to add up the values of the different months and specify between the 4th one on the 4th of another?

    Thanks in advance.

    One way to do would be to use SUMIFS.

    The formula in B2, filled to the bottom:

    = SUMIFS(Table 1::$E,Table 1::$A,">"&C2,Table 1::$A,"<"&D2)

    The formula in C2, filled to the bottom:

    = A2 + 4

    The formula in D2, filled to the bottom:

    = EOMONTH(A2,0) + 5

    Column A contains strings of date and time in the format to display the month only.

    SG

  • I can't change the values of advanced type (exponent and index)

    When I try to use index and exponent my text disappears. First of all, I think that it is related to my font, but when I open Type preferences / advanced, I saw that the values of size and location of the exhibitor and index are nil. Whenever I changed it and they zero tricks once again. I want to reset these values and set as default on a permanent basis.

    Thank you for the answers.

    I use my native language (Turkish) InDesing because Adobe offers student only in the native language edition.

    (I hope that they will also offer English version. Because it's the translation is terrible).

    Default values for new text are defined by making changes with no selected text (and no active text cursor). If there is an open document, the default will apply only in the current document, any document open will apply to all new files. No change in the defaults will change existing text, or the default value for any existing document that is not active at the time the change is made, so all existing files need manual corrections.

  • Sum of the values of the previous rows in a PivotTable

    Hello

    I have a dynamic table has several lines (dynamically added via a button).  A column in the table is a quantity column.  Another is a Total of the column.  We do not keep a cumulative, but wants to only display an total when the rest of the cells in the same row are emty and the previous lines has / have values in the quantity column.  The Total is the sum on the Quatnities until a blank line.  Here is a sample.  How can I get the value of the quantities in the previous lines?

    Quantity Total


    5
    8
    12

    25


    7
    27

    34


    22

    22


    Another option could be to put the Total in the last row with data as opposed to the line below the data.

    Any ideas?

    Kind regards

    Karl

    The script is written to achieve your requirement (i.e. the second approach you mentioned)

    .

    You can either contact me at [email protected] for the example of created form.

    Or what follows is the Source XML of the form. Copy all the content in your form XML source mode and see the result.

    http://ns.Adobe.com/XDP/"timeStamp =" "2012-02 - 28 T 14: 04:54Z ' uuid ="2c561cdf-3377-4e84-9a89-51e740bb2fea">"

    Adding line

    Quantity

    Total

    user interface

    >

    character = "Myriad Pro

    "/>

    margin = topInset ' 1 mm ' bottomInset = ' 1 mm ' leftInset = ' 1 mm ' rightInset = ' 1 mm»

    "/>

    para vAlign = "middle".

    "/>

    border

    >

    edge

    />

    angle thickness = "0,1778 mm

    "/>

    border

    >

    field

    >

    = "Total" field name "44.47 mm" h = w = "9,317 mm" access = "readOnly".

    ">

    user interface

    >

    numericEdit

    >

    presence at the border = "hidden".

    ">

    border

    >

    the margin of

    />

    numericEdit

    >

    user interface

    >

    character = "Myriad Pro

    "/>

    margin = topInset ' 1 mm ' bottomInset = ' 1 mm ' leftInset = ' 1 mm ' rightInset = ' 1 mm»

    "/>

    this.rawValue = null; Clear the total value

    }

    } catch (e)

    {

    app.alert (e)

    }

    9.0.0.0.20091029.1.612548.606130

    http://www.XFA.org/schema/XCI/2.8/">

    PDF

    1.7

    3

    *

    http://www.XFA.org/schema/XFA-locale-set/2.7/">

    January

    February

    March

    April

    May

    June

    July

    August

    September

    October

    November

    December

    Jan

    Feb

    Mar

    Apr

    May

    Jun

    Jul

    Aug

    Ms

    Oct

    Nov

    Dec

    Sunday

    Monday

    Tuesday

    Wednesday

    Thursday

    Friday

    Saturday

    Sun

    LUN

    Mar

    Fri

    Game

    Fri

    Sam

    AM

    PM

    BRITISH COLUMBIA

    AD

    EEEE, MMMM D, YYYY

    MMMM D, YYYY

    MMM D, YYYY

    M/D/YY

    SS Z

    SS Z

    SS HAS

    h: mm A

    GyMdkHmsSEDFwWahKzZ

    z, zz9.zzz

    $z, zz9.99 | ($z, zz9.99)

    z, zz9%

    .

    ,

    %

    -

    0

    $

    USD

    .

    "RDF: RDF xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#

    ">

    "RDF: description xmlns:xmp ="http://ns.adobe.com/xap/1.0/"rdf: subject"

    ="">

    XMP:MetadataDate > 2012-02-28 T 14: 04:54Z

    >

    XMP:CreatorTool > Adobe LiveCycle Designer ARE 9.0

    >

    RDF: description

    >

    "RDF: description = xmlns:pdf"http://ns.adobe.com/pdf/1.3/"rdf: subject"

    ="">

    PDF:producer > Adobe LiveCycle Designer ARE 9.0

    >

    RDF: description

    >

    "RDF: description = xmlns:xmpMM"http://ns.adobe.com/xap/1.0/mm/"rdf: subject"

    ="">

    xmpMM:DocumentID > uuid:2c561cdf-3377-4e84-9a89-51e740bb2fea

    >

    RDF: description

    >

    "RDF: description = xmlns:desc"http://ns.adobe.com/xfa/promoted-desc/"rdf: subject"

    ="">

    DESC:version rdf:parseType = "resource".

    ">

    RDF: value > 9.0.0.0.20091029.1.612548.606130

    >

    DESC:REF > / template/subform [1]

    >

    DESC:version

    >

    RDF: description

    >

    RDF: RDF

    >

    x: xmpmeta >

  • How to calculate the sum of the values of some columns in a table

    Hello

    I want to get the column just the average of the values of some columns not all columns of the table.what I have to change exactly in this block diagram.even if the table size is 25 average, I want the division as the number of values in each column (= number of lines)

    just like that:


  • Displays the value of double type

    Hi - another crazy me today. With the help of v % of the SDK. Memorization of the GPS coordinates in a persistent storage which is fine. So want to show these results on a screen by updating a labelField with the value.

    the code below, printLn myTest displays a value of something as 42.1234 gets so thin value. However, with the code so I get Double.toString (myTest) cann't find symbol even though I java.lang. *; imported. If I remove this line of double.toString then it will compile, but throws an exception error when I try to display on the screen. Can someone help a newbie pls...

    If (persistentHashtable.containsKey ("LVFLat")) {}
    Double myTest is (Double) persistentHashtable.get ("LVFLat");.
    System.out.println ("# latitude =" + myTest);
    String finalLat = Double.toString (myTest);
    displayLVFLat.setText (myTest);
        
    }

    You must read the documentation of the API and note the use of capital letters and tiny.  Capitals: the object, tiny, primitive.  Read the API done again and see what I mean.

    You want to replace this:

    String finalLat = Double.toString (myTest);

    with

    String finalLat = myTest.toString ();

  • The value of xml type column in oracle database 11 g 2

    I have a table containing columns XMLtype as 'XML_TABLE (ID NUMBER, donnees_xml XMlTYPE).

    Then I insert a value such as

    INSERT INTO xml_table (1, XMLtype('<current>
          <city id="2643743" name="London">
            <coord lon="-0.13" lat="51.51"/>
            <country>GB</country>
            <sun rise="2015-03-04T06:38:20" set="2015-03-04T17:46:01"/>
          </city>
          <temperature value="280.71" min="280.15" max="281.15" unit="kelvin"/>
          <humidity value="77" unit="%"/>
          <pressure value="1029" unit="hPa"/>
        </current>'));
    


    Now, I want to ask about this table. I can easily choose 'country' with the following query

    select t.xml_data.extract('/current/city/country/text()').getStringVal() "XML Data"
    from xml_table t;
    

    But I can't select the value of the temperature by this query. Now how to select the value of the temperature of the table?

    EXTRACT, EXTRACTVALUE etc are deprecated in 11.2.

    Use instead the XQuery functions.

    If you need to retrieve several values, XMLTABLE will be good:

    SQL> alter session set nls_numeric_characters = ".,";
    
    Session altered.
    
    SQL>
    SQL> select x.*
      2  from xml_table t
      3     , xmltable(
      4         '/current'
      5         passing t.xml_data
      6         columns country     varchar2(10) path 'city/country'
      7               , temperature number       path 'temperature/@value'
      8       ) x
      9  ;
    
    COUNTRY    TEMPERATURE
    ---------- -----------
    GB              280.71
    
  • How do rotate on a date and see the sum of the value of another column

    Hello

    I searched through the forum and cannot find a query similar to my question feels so post this new thread.

    First of all, it is probably useful indicating that I am using Oracle 10 g.

    I have a table that is used to store the details of the booking (essentially a booking system) and I would use this data to display the details of the customers stay on one line.

    The table has the following columns:
    BOOKING_ID
    CUSTOMER_ID
    DATE_OF_ARRIVAL
    NUMBER_OF_NIGHTS
    NUMBER_OF_PEOPLE
    Some example records could be:

    BOOKING_ID    CUSTOMER_ID     DATE_OF_ARRIVAL    NUMBER_OF_NIGHTS   NUMBER_OF_PEOPLE
    --------------------------------------------------------------------------------------------
    1                    201      13-JAN-2010        5                   1
    2                    202      13-JAN-2010        3                   2  
    3                    202      13-JAN-2010        4                   1
    4                    203      15-JAN-2010        2                   3
    On this basis I would like to display the output so that I can show a sum of the NUMBER_OF_PEOPLE reserved to per customer per day, as such:
    CUSTOMER_ID     13-JAN   14-JAN   15-JAN   16-JAN   17-JAN   18-JAN   19-JAN 
    -----------------------------------------------------------------------------------------
    201                   1       1        1        1        1        0        0
    202                   3       3        3        1        0        0        0
    203                   0       0        3        3        0        0        0
    I watched analytical functions in the documentation and several books of Oracle that I have, but have so far struggled to find how to make the performance desired. Even using the excellent response to the previous post on the forum, I got Re: how to count the occurrence of a date in a range I was not able to get a feasible request.

    Any help or advice would be much appreciated.

    Kind regards
    Stu

    Published by: macmanxie on January 10, 2011 21:16

    Hello

    macmanxie wrote:
    ... The suggested approach goes only to return a number if the DATE_OF_ARRIVAL corresponds to the date in the CASE statement, however I have the added complexity of wanting to show a count of all the days that the customer is booked, for, by making use of the NUMBER_OF_NIGHTS. I tried to use some of the examples provided on morganslibrary.org, for example:

    sum( CASE WHEN  TRUNC (arrival_date) between '01/13/2011' and TRUNC (arrival_date+no_of_nights) THEN nvl(no_of_people,0) ELSE 0 END) AS jan_13
    

    but this does not produce the desired result.

    You check if arrival_date is between January 13 and arrival_date + no_of_nights (as if the arrival date could all be posterior to the arrival_date + no_of_nights).
    Are not really interested in whether or not January 13 ib between arrival_date and arrival_date + no_of_nights?

    NVL ( SUM ( CASE
                    WHEN  TO_DATE ( '01/13/2011'
                           , 'MM/DD/YYYY'
                         )          BETWEEN  TRUNC (arrival_date)
                             AND       TRUNC (arrival_date) + no_of_nights
                 THEN  no_of_people
             END
           )
        , 0
        )          AS jan_13
    

    Always format your code. It is important to format your code if you are the only who who will ever read but it is even more important if you are posting on a forum like this and ask other people to read.
    Not to compare the DATEs in the strings; explicitly use a conversion function, like TO_DATE, above, where necessary.
    Both
    SUM (NVL (x, 0)) and
    NVL (SUM (x), 0) get the same results, but the latter is more effective. If you have 1000 lines, the first way is calling NVL 1000 times, but the second way is calling only once.

    If your previous thread
    Re: How to count the occurrence of a date in a range
    Gets you the right data, but it has one row for each distinct combination of customer_id and date, then you can switch it to a form that contains a line by the customer and another column for each date.

    If you need help, post CREATE TABLE and INSERT statements for some examples of data and outcomes from these data. The post you are trying better to a request, including a subquery that gets no cross-the raw table dynamic results.
    There will be a fixed number of columns in the output swing? If this is not the case, how do you deal with that? Which of these options in the thread I posted above)
    Re: County report and the sum of the number of rows by multiple columns
    ) is best for your needs? Than others is acceptable?

Maybe you are looking for

  • Firefox says adobe won't work, update installed, still does not

    Firefox said my Adobe must be updated - I update the program and still get the same error message and adobe is not no longer works.

  • Cannot find graphics drivers for my Satellite A500D-10F

    It uses Ati 4650 and I bought it new and it's not graphics drivers for it... Should I return it or where can I get graphics drivers?I am using windows 7 64 bit Post edited by: satyrion

  • Windows product key

    I turned on my laptop HP pavallion g6, but forget to keep this product key for windows 8. I am interested to install other OS also like ubuntu, bt without knowing the product key original I'm afrid to do. someone please help me find my original produ

  • How to order the two fans for vista

    How to do for fans to order both for my family vista premium, erro messages get that fans do not work Need to know how much cost fans

  • Cannot print from IE 8 after upgrading Vista to Windows 7

    My laptop (HP Elitebook 8530w) uses two HP printers: Color LaserJet CP3525x (at work) and Deskjet 6940 (at home). Both printers are accessible via a local network. I've recently upgraded to Vista Enterprise to Windows 7 Enterprise. All still print fi