Sum of the combination of columns count

Hi guru and expert.

Help me please how to code this requirement in the PIF. (Please copy and paste in Excel the table below for the best table of data)

Example of output:

# GROUP SALES MARKETING TEAM BUSINESS HEAD RM/AO ADJUSTMENT TYPE ADJUSTMENT REASON NEWS REQUESTS THIS PERIOD
Number OF QUERIES AMOUNT AMOUNT IN PhP
1 CRM a CRB 1 BH3 RM5 recipes without acknowledgement of receipt 1 PHP400 400 Service
2 CRM a CRB 1 BH4 RM6 operational reimbursements (failures / Interruption of Service) 1 PHP100 100
3 CRM a CRB 1 BH4 RM6 operational reimbursements (failures / Interruption of Service) 1 USD100 5,000.00
4 CRM a CRB 1 BH1 RM1 back continuous billing 1 400 USD 20 000.00
5 CRM a CRB 1 BH1 RM1 back continuous billing PHP800 2 800
6 CRM B CRB 1 BH3 RM1 continuous income 1 billing USD210 10,500.00
7 CRM B CRB 1 BH5 RM8 recipes without acknowledgement of receipt 1 PHP500 500 Service
8 CRM B CRB 1 BH5 RM8 recipes without receipt Service 2 USD750 37 500.00
9B CRM incorporate BH7 RM7 effective operational disputed billing Date 1 USD20 1 000,00
10 B CRM incorporate BH2 RM3 operational returned cheques 1 PHP200 200
11 B CRM incorporate BH2 RM3 operational returned cheques 3 USD270 13,500.00
PhP89, 500.00


Expected results:

# GROUP SALES MARKETING TEAM BUSINESS HEAD RM/AO ADJUSTMENT TYPE ADJUSTMENT REASON NEWS REQUESTS THIS PERIOD
Number OF QUERIES AMOUNT AMOUNT IN PhP
1 CRM a CRB 1 BH3 RM5 recipes without acknowledgement of receipt 1 PHP400 400 Service
2 CRM a CRB 1 BH4 RM6 operational reimbursements (failures / Interruption of Service) 1 PHP100 100
3 CRM a CRB 1 BH4 RM6 operational reimbursements (failures / Interruption of Service) 1 USD100 5,000.00
4 CRM a CRB 1 BH1 RM1 back continuous billing 1 400 USD 20 000.00
5 CRM a CRB 1 BH1 RM1 back continuous billing PHP800 2 800
6 PhP26300
6 CRM B CRB 1 BH3 RM1 continuous income 1 billing USD210 10,500.00
7 CRM B CRB 1 BH5 RM8 recipes without acknowledgement of receipt 1 PHP500 500 Service
8 CRM B CRB 1 BH5 RM8 recipes without receipt Service 2 USD750 37 500.00
4 PhP48500
9B CRM incorporate BH7 RM7 effective operational disputed billing Date 1 USD20 1 000,00
10 B CRM incorporate BH2 RM3 operational returned cheques 1 PHP200 200
11 B CRM incorporate BH2 RM3 operational returned cheques 3 USD270 13,500.00
5 PhP14700

Kind regards

Jean Paul

As a simple solution, you can group data based on group and team sales, then on other 4 columns.
This way you can easily follow the end of the combination of group sales / team and print the number and total it.

Tags: Business Intelligence

Similar Questions

  • The combination of columns or cells

    In a GIANT spreadsheet I I'd like to combine the columns. Column A is a list of part numbers, column C is a list of product names, column D is a list of product sizes:

    I want to make a version of this spreadsheet in which these lists are combined:

    I hope that there is a simple process to avoid all copy & pastes each cell... simply combine several columns?

    Hi Mr. Bacon,.

    Something like that?

    Quinn

  • the combination of columns 2 and 3 css help

    I need assistance with the creation of the 2 column and 3 column settings for presentations using css journal type column.

    Im going to use a html to dreamweaver with fixed width template, the header and sidebar for navigation footer. My concept of design will be a block of text in css of two columns or introduction top of page under the banner/logo. Then less than a large banner for the separation and, finally, an image 3 column css text / image block sector.

    Can someone give me some pointers to or the direction for this we put up. Is there an example of code that I could change or twist on my design needs?

    Thanks in advance.

    Which does not seem too difficult.

    There are probably more than one way to skin this particular cat, but if you want a focused presentation you must first a container for the Center on the page and giving a width.

    Inside this container, you would have your header div.

    After another container and two columns that together would be block-level elements.

    Then another div container and your three items at the level of your three columns block.

    Then

    I don't think that your columns must be div elements, they could be

    elements, but it depends on how you add your content.

    Once you have your HTML, you need to float the columns.  You need a little math here because they need a width of the floating element and the combined width must not exceed the width of the container.  You should also pay attention to the margin, padding, width and the box model.

    My use of ID names is a bit awkward, but it shows my way of thinking.

    I hope that aid, my caveat is that I'm not an expert so we could both be guided by an expert to put us right!

    Kind regards

    Martin

  • 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?

  • How to only the totals using the native summary column (= "SUM () function

    Hi all, this is my data model:

    < name of dataTemplate 'Employees' description = 'Simple Dept - Emp' = >
    < dataQuery >
    < SQLStatement instance name = "Q1" >
    <! [CDATA]
    Select SERVICES. DEPTNO as DEPTNO,
    DEPARTMENTS. DNAME as a DNAME
    Scott. MINISTRIES DEPT order by DEPTNO]] >
    < / sqlStatement >
    < SQLStatement instance name = "Q2" >
    <! [CDATA [Select
    EMPLOYEES. ENAME like EMP_NAME,
    EMPLOYEES. EMPNO as EMPNO,
    EMPLOYEES. Hiring as HIREDATE date,
    EMPLOYEES. SAL as WAGES,
    EMPLOYEES. DEPTNO as EMP_DEPTNO
    Scott. EMPLOYEES OF THE EMP
    where EMPLOYED. [[DEPTNO =: DEPTNO]] >
    < / sqlStatement >
    < / dataQuery >
    < dataStructure >
    < name of group = "G_DEPT" source = "Q1" >
    < element name = "DEPTNO" value = "DEPTNO" / >
    < element name = "DNAME" value = "DNAME" / >
    < element name = "TOTAL_EMPS" value = "G_EMP. EMPNO"function ="COUNT ()"/ >
    < element name = "TOTAL_SALARY" value = "G_EMP. SALARY"function ="SUM ()"/ >
    < element name = "AVG_SALARY" value = "G_EMP. SALARY"function ="AVG ()"/ >
    < element name = "MAX_SALARY' value = 'G_EMP. SALARY"function ="MAX ()"/ >
    < element name = "MIN_SALARY" value = "G_EMP. SALARY"function ="MIN ()"/ >
    < name of group = "G_EMP" source = "Q2" >
    < feature name = 'EMPNO' value = 'EMPNO' / >
    < element name = "EMP_NAME" value = "EMP_NAME" / >
    < element name = "HIREDATE" value = "HIREDATE" / >
    < element name = "SALARY" value = "SALARY" / >
    < / Group >
    < / Group >
    < / dataStructure >
    < / dataTemplate >

    This datatemplate works very well with the TOTAL_EMPS, TOTAL_SALARY, AVG_SALARY, MAX_SALARY MIN_SALARY split for all departments; So these are subtotals.

    Now, I need to have the totals at the end of my report to the following:

    TOTAL_ALL_EMPS
    TOTAL_ALL_SALARY
    TOTAL_ALL_AVG_SALARY
    TOTAL_ALL_MAX_SALARY
    TOTAL_ALL_MIN_SALARY

    Add a new query (Q1) with all the totals, now the data model is the following:

    < name of dataTemplate 'Employees' description = 'Simple Dept - Emp' = >
    < dataQuery >
    < SQLStatement instance name = "Q1" >
    <! [CDATA]
    Select COUNT (empno) TOTAL_ALL_EMPS, SUM (sal) TOTAL_ALL_SALARY, AVG (sal) TOTAL_ALL_AVG_SALARY, MAX (sal) TOTAL_ALL_MAX_SALARY MIN (sal) scott TOTAL_ALL_MIN_SALARY. EMPLOYEES EMP]] >
    < / sqlStatement >
    < SQLStatement instance name = "Q2" >
    <! [CDATA]
    Select SERVICES. DEPTNO as DEPTNO,
    DEPARTMENTS. DNAME as a DNAME
    Scott. MINISTRIES DEPT order by DEPTNO]] >
    < / sqlStatement >
    < SQLStatement instance name = "Q3" >
    <! [CDATA [Select
    EMPLOYEES. ENAME like EMP_NAME,
    EMPLOYEES. EMPNO as EMPNO,
    EMPLOYEES. Hiring as HIREDATE date,
    EMPLOYEES. SAL as WAGES,
    EMPLOYEES. DEPTNO as EMP_DEPTNO
    Scott. EMPLOYEES OF THE EMP
    where EMPLOYED. [[DEPTNO =: DEPTNO]] >
    < / sqlStatement >
    < / dataQuery >
    < dataStructure >
    < name of group = "G_TOT" source = "Q1" >
    < element name = "TOTAL_ALL_EMPS" value = "TOTAL_ALL_EMPS" / >
    < element name = "TOTAL_ALL_SALARY" value = "TOTAL_ALL_SALARY" / >
    < element name = "TOTAL_ALL_AVG_SALARY" value = "TOTAL_ALL_AVG_SALARY" / >
    < element name = "TOTAL_ALL_MAX_SALARY" value = "TOTAL_ALL_MAX_SALARY" / >
    < element name = "TOTAL_ALL_MIN_SALARY" value = "TOTAL_ALL_MIN_SALARY" / >
    < / Group >
    < name of group = "G_DEPT" source = "Q2" >
    < element name = "DEPTNO" value = "DEPTNO" / >
    < element name = "DNAME" value = "DNAME" / >
    < element name = "TOTAL_EMPS" value = "G_EMP. EMPNO"function ="COUNT ()"/ >
    < element name = "TOTAL_SALARY" value = "G_EMP. SALARY"function ="SUM ()"/ >
    < element name = "AVG_SALARY" value = "G_EMP. SALARY"function ="AVG ()"/ >
    < element name = "MAX_SALARY' value = 'G_EMP. SALARY"function ="MAX ()"/ >
    < element name = "MIN_SALARY" value = "G_EMP. SALARY"function ="MIN ()"/ >
    < name of group = "G_EMP" source = "Q3" >
    < feature name = 'EMPNO' value = 'EMPNO' / >
    < element name = "EMP_NAME" value = "EMP_NAME" / >
    < element name = "HIREDATE" value = "HIREDATE" / >
    < element name = "SALARY" value = "SALARY" / >
    < / Group >
    < / Group >
    < / dataStructure >
    < / dataTemplate >

    It works fine, but my question is this:

    How can I change the data model and use the native summary column (function = "SUM (), for example) to collect data that I mentioned above (TOTAL_ALL_EMPS, TOTAL_ALL_SALARY, etc.), in order to avoid a third query SQL (Q1)?
    In a few words, I would only use the query Q2 and Q3 and have overall totals and subtotals.

    Thanks in advance for any help

    Alex




    Select 1 double DUMMY_FIELD]] >


    Select SERVICES. DEPTNO as DEPTNO,
    DEPARTMENTS. DNAME as a DNAME
    Scott. MINISTRIES DEPT order by DEPTNO]] >


    EMPLOYEES. ENAME like EMP_NAME,
    EMPLOYEES. EMPNO as EMPNO,
    EMPLOYEES. Hiring as HIREDATE date,
    EMPLOYEES. SAL as WAGES,
    EMPLOYEES. DEPTNO as EMP_DEPTNO
    Scott. EMPLOYEES OF THE EMP
    where EMPLOYED. [[DEPTNO =: DEPTNO]] >






















    Try this

    Concerning
    Charlotte

  • Select the duplicate rows, based on a combination of columns as the key

    Hello

    I have a table with 5 columns.

    Code ID S_DATE E_DATE name
    1 23 01012001 null ABC
    1 09 01012001 null XYZ
    2 81 04022007 null TVU
    1 43 03092008 null XXX



    Now, I need to write a select statement to extract the lines duplicated in the table above with the combination of (Code, S_DATE, E_DATE) as the key.
    So in the above example, I need to get Row1 and Row2 as output (but not Row3 as she has a different S_DATE)

    Thanks in advance for your suggestions.

    Thank you

    Published by: thotaramesh on March 9, 2009 16:54

    The XE;

    WITH sample_data AS (
       SELECT 1  code,23 ID, '01012001' s_date, null e_date, 'ABC' NAME FROM dual UNION ALL
       SELECT 1, 09, '01012001', null, 'XYZ' FROM dual UNION ALL
       SELECT 2, 81, '04022007', null, 'TVU' FROM dual UNION ALL
       SELECT 1, 43, '03092008', null, 'XXX' FROM dual)
    SELECT code, ID, s_date, e_date, NAME
    FROM (
       SELECT
          sample_data.*,
          COUNT(*) over (PARTITION BY code, s_date, e_date) dups
       FROM sample_data)
    WHERE dups > 1;
    
          CODE         ID S_DATE   E_DATE NAME
    ---------- ---------- -------- ------ ----
             1         23 01012001        ABC
             1          9 01012001        XYZ
    
  • Table of the sum of the column of clusters

    How I will summarize the table of cluster someone column? As attachmend table of example of clusters.

    Use a shift on your loop register FOR keeping the sum.  You add the sum of the currents with the value of the current cluster and set the value in the registry to offset.  Need you one for every amount you want to take.

  • The Master Table column updated based on the sum of column Table detail


    With the help of JDev 11.1.1.6.

    I have a master-detail table based on a link to BC.

    The main table has a column that displays an InputText or an OutputText, based on the value in another column.

    If the InputText is displayed, the user can enter a value and the database will be updated with that value.

    If the OutputText is displayed, it must be a sum of a column in the secondary table.  Also, this value will be written in the database.

    Question:

    How can I fill the OutputText in the main table with the sum of the values in a column in the secondary table?

    The detail table column is a manually entered InputText field.

    Thank you.

    Create a spike in the main table and write in its expression as follows - DetailVoAccessorName.sum ("ColumnName");

    This will calculate the sum of column table detail and then you can set the value of the transient attribute to attribute DB on backup operation

    Ashish

  • 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

  • How can I create a constraint on the combination of four columns...

    Dear Guru,

    I have a question... I created the table with columns like "CCode', 'Size1', 'Size2', 'Sch1', 'Sch2', 'Description', 'CCdate '.

    Here I wanted to create a unique constraint on the combination of four columns "CCode', 'Size1', 'Size2', 'Sch1', 'Sch2.

    My requirement is that I don't want to allow duplicate records in the table for the four columns only.

    for example: "CC123", 10, 25, S110, S250,.

    If the new record comes with the same data. Then, I do not want to insert this record.i want to get a constraint voilated error.

    How can I create a constraint on the combination of four columns...

    Pls help me on this issue...

    Kind regards

    Shitab...

    I suggested already here the syntax,

    ALTER table your_table

    Add constraint cons_name unique (col1, col2, col3, col4, col5);

    And don't call me 'Sir '.

    See you soon!

  • Calculate the sum of the columns

    Hello!

    Am using jdeveloper 11.1.2.1

    I created a table VO based EO. I need to calculate the sum of the column named price.

    I use the expression PoView.sum ("Price"). In this PoView is the name of VO and the price is the name of the column.

    While spin AMModule I got an exception like

    PoView name not found in the given object.

    Hello

    You must use the name accessor EO or VO instead of the name of VO.
    See https://blogs.oracle.com/adf/entry/using_groovy_aggregate_functions_in (there are even the same error message in one of the comments of this blog)

    concerning
    Peter

  • Sum of the two columns

    Hello.

    I use jdev 11.1.5

    = > I had created a Vo in the adf with the table named GrlJrl
    I need the sum of the two columns

    My scenario

    Da Ca
    500 100
    600 100
    100 200
    S 400 1200 (adding two field must be displayed in the user interface).

    someone help me reach this goal

    chk this
    Calculate the sum involved new VO

  • How to count the number of columns in an oracle table using sql

    How to count the number of columns in an oracle table using sql

    You must put the name of the table in capital letters

    As

    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = 'EMP';
    
    or
    
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = UPPER('Emp');
    

    Concerning
    Arun

  • find the cumulative sum of the previous columns

    Hello

    How can I get the cumulative sum of a particular column in the preceding lines in the current line.
    e.g. I have a table produced,

    Date | Orders
    __________________
    1 JANUARY 10 | 3
    JANUARY 2, 10. 5
    JANUARY 3, 10. 1

    I want to select the date and orders between the 1st and the 3rd. Something like...
    Select the Date, the orders for products where Date between to_date('1-JAN-10') and to_date('3-JAN-10')

    But I want the output like this...

    Date | Orders
    __________________
    1 JANUARY 10 | 0
    JANUARY 2, 10. 3
    JANUARY 3, 10. 8

    Similarly, when I select it between 2 and 3, I want the output voltage...

    Date | Orders
    _________________
    JANUARY 2, 10. 3
    JANUARY 3, 10. 8

    and so on. In the output, orders here are the cumulative sum of the previous columns.

    Published by: eric clapton, November 8, 2010 20:45

    Hello

    Use the analytical SUM function.
    You want to filter by date after the cumulative SUM is calculated, so calculate the SUM in a subquery, then filter by date no later than:

    WITH     got_cm_orders     AS
    (
         SELECT     dt
         ,     orders
         ,     SUM (orders) OVER (ORDER BY dt) - orders
                   AS cm_orders
         FROM     products
    )
    SELECT     dt
    ,     orders
    WHERE     dt     BETWEEN     DATE '2010-01-02'
              AND     DATE '2010-01-03'
    ;
    
  • The combination of two columns in a single

    Hi guys,.

    Is it possible for a query to combine two columns into one? For example, lets say I have the following query:

    SELECT ID, FIRST_NAME, LAST_NAME
    EMPLOYEES

    I want the output to have two columns: one that contains the ID and the other containing name followed by a space followed by LAST_NAME. I know how to do this outside the query using coldfusion, but it save me a lot of work if there is some way that the query could do for me.

    Yes but the operand of concatenation varies somewhat from a database
    management system to the other.

    In Oracle, it would look this IIRC.

    SELECT ID, FIRST_NAME. ' ' || LAST_NAME AS FULL_NAME
    EMPLOYEES

Maybe you are looking for