Need to run a query to select the number of charges based on each month

Let's say I have a talble with 12 months, each month has some data.

I want to run a count (*) select to get the result of how many lines a month, like Jan - Feb - 90, 100, etc..


How do I do that?

Thanks in advance.

Try this...

select to_char(sysdate,'Month'), count(*) from table_name
group by to_char(sysdate,'Month');

Concerning

UMI

Tags: Database

Similar Questions

  • Query help - to get the number of employees joined on each month regardless of the year

    Hi all

    I wrote the code below for number of employees joined each month regardless of the year of the employee table. But I couldn't get the result. Kindly help me where I'm wrong in my code,

    Select to_char (hiredate, 'my') as join, count (empno) under the number

    WCP

    To_char Group (hiredate, 'my')

    After having count (empno) > 1;

    Your application displays the list of months (regardless of the year) where more than one employee was engaged with number of emplyees hired this month here. If you want months even if nobody was hired months thast, you emp table outer join to the list of every month:

    with t as)

    Select the level m

    of the double

    connect by level<=>

    )

    Select to_char (to_date (TM, 'mm'), 'my') Lun,

    Count (e.empno) cnt

    t

    left join

    E EMP

    on Tahina = to_char (e.hiredate, 'mm')

    Group of Tahina

    order of Tahina

    /

    MY CNT
    --- ----------
    1 jan
    February 2
    Mar 0
    Apr 2
    May 2
    1 Jun
    July 0
    August 0
    2 sep
    Oct 0
    1 nov

    MY CNT
    --- ----------
    Dec 3

    12 selected lines.

    SQL >

    SY.

  • I need a query that selects the amount of records for each day of a table.

    I need a query that selects the amount of records for each day of a table.
    For example, the result would be:

    1 14 date
    Date 2-3

    etc.

    Any ideas?

    Sort:

    SELECT count ([IDCommentaire]), convert (varchar, dateAdded, 112)

    OF COMMENTSgroup by convert (varchar, dateAdded, 112)

  • SQL query to get the number of days monthwise

    Hello
    I'm new to sql, can someone please tell me query to find the number of days between the two dates months wise.
    say
    FIRSTDATE last date
    21/03/2011-25/06/2011

    March April May June
    9 22 23 18

    Hello

    Welcome to the forum!

    Here's one way:

    WITH     all_dates     AS
    (
         SELECT     start_date + LEVEL - 1     AS a_date
         FROM     (
                   SELECT     TO_DATE ('21/03/2011', 'DD/MM/YYYY')     AS start_date
                   ,     TO_DATE ('25/06/2011', 'DD/MM/YYYY')     AS end_date
                   FROM     dual
              )
         CONNECT BY     LEVEL     <= end_date + 1 - start_date
    )
    SELECT       TO_CHAR ( TRUNC (a_date, 'MONTH')
                , 'fmMonth YYYY'
                )               AS month
    ,       COUNT (*)               AS num_days
    FROM       all_dates
    WHERE       a_date - TRUNC (a_date, 'IW')     < 5
    GROUP BY  TRUNC (a_date, 'MONTH')
    ORDER BY  TRUNC (a_date, 'MONTH')
    ;
    

    What is a 'working day '? I guess you mean every day except Saturday or Sunday, but the query aboveare sometimes figures less than you have asked:

    MONTH             NUM_DAYS
    --------------- ----------
    March 2011               9
    April 2011              21
    May 2011                22
    June 2011               18
    

    Are a few days working on Saturday or Sunday? How do you get the 22 working days in April 2011 and 23 in may?

    SQL is good at obtaining results with a variable number of rows, but you have to say exactly the desired number of columns when you write the query.
    If you really need the output of the way you said, with any number of columns, then watch in swing or a grouping of the chain . See the FAQ forum
    https://forums.Oracle.com/forums/Ann.jspa?annID=1535
    "4. How can I convert rows to columns.

  • Query to retrieve the number of transactions in every 1 hour for the end

    Hello

    Could someone help to write a query to retrieve the number of transactions in every hour for the last month.

    Case:
    I / P

    If Timestamp1
    1 01/01/2008 00:00:01
    CAS2 01/01/2008 00:01:01
    case3 01/01/2008 01:00:01
    1 01/01/2008 01:02:01
    case4 01/01/2008 01:10:01
    Service5 01/02/2008 02:00:01
    Case6 01/02/2008 02:10:01
    case7 2008-02-01 23:00:01
    .............................

    .............................
    case... 2008-01-31 00:24:00


    O/P
    cases of to_time of time
    2008-01-01 00:00:00 01/01/2008 01:00 2
    2008-01-01 01:00:01 01/01/2008 02:00 3

    .........................
    .........................

    etc.

    Any help really appreciated

    We can do this by using analytic functions

    Here's what I did:

    create table timestamp1 (date of ts)

    Select * from timestamp1
    2008-10-30 15:41:13
    2008-10-30 15:41:05
    2008-10-30 15:40:03
    2008-10-30 14:58:26
    2008-10-30 14:29:45
    2008-10-30 13:17:48
    2008-10-30 08:29:50
    2008-10-30 06:05:51
    2008-10-30 03:41:52
    2008-10-30 02:29:54

    Select distinct to_char (ts, 'hh24') frmhrs,
    TO_CHAR (ts, 'hh24') + 1 tohrs, count (ts) OVER (order by to_number (to_char (ts, 'hh24')) RANK BEFORE (1/24))
    of timestamp1
    When trunc (ts) = trunc (sysdate) - I added this just to make sure that I get for data of today
    order of frmhrs

    FRMHRS TOHRS CNT
    1-3-02
    03-4-1
    06 7 1
    1-9-08
    13 14 1
    14 15 2
    15 16 3

    You can customizeas by your need.

  • Select the number of months (NULL and non-null separated)

    -Table_1
    -------------

    create table_1
    (
    Arrival_Date DATE
    Counter_seq number (*) not null,
    Exclusion_type varchar2 (10)
    )

    -INSERTION
    -------------

    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-DEC-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 1,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 2, 'PAW');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-DEC-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 3, 'HAN');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 4,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 5,"LUG");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-JAN-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 6, 'HAN');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-DEC-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 7,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 8, 'PAW');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 9, 'HAN');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 10,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-DEC-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 11, 'PAW');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 12, 'HAN');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-DEC-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 13,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 14,"LUG");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 15,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 16,"LUG");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 17,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 18,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-DEC-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 19, 'HAN');
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-DEC-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 20,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 21,"LUG");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 22,"LUG");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-DEC-2009', 'dd-Mon-yyyy HH:MI:SS AM'), 23,"HAN");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-JAN-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 24,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 25,");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('28-DEC-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 26,"LUG");
    INSERT INTO 'DW_DOCA '. "' TABLE_1 ' ('ARRIVAL_DATE', 'COUNTER_SEQ', 'EXCLUSION_TYPE') VALUES (TO_DATE('12-FEB-2010', 'dd-Mon-yyyy HH:MI:SS AM'), 27,");


    -SELECT THE NUMBER OF MONTHS
    --------------------------------------

    SELECT EXCLUSION_TYPE,
    County (decode (to_char (ARRIVAL_DATE, 'MON-YYYY'), "DEC-2009", COUNTER_SEQ ")) dec09,.
    County (decode (to_char (ARRIVAL_DATE, ' MON-YYYY ""), "JAN-2010", COUNTER_SEQ ")) Jan10.
    County (decode (to_char (ARRIVAL_DATE, 'MON-YYYY'), ' Feb-2010 ", COUNTER_SEQ")) Feb10
    FROM TABLE_1
    EXCLUSION_TYPE GROUP;


    -CHOOSE IT ABOVE RETURENS: -.
    ------------------------------------------------


    EXCLUSION_ DEC09 JAN10 FEV10
    4 4 4
    0 3 4 LEG
    HAN 3 2 0


    My question is, I need to select a month ruturning one row of NULL values and a line of values not null. Like that so all right: -.

    EXCLUSION_ DEC09 JAN10 FEV10
    Exclusion_Type 4 4 4 NULL
    Exclusion_Type Not null 3 5 4

    The ideas people?

    Published by: Deeds_2001 on November 16, 2010 12:47 AM
    SQL> SELECT DECODE(exclusion_type,NULL,'NULL','NOT NULL') exclusion_type,
      2  COUNT(DECODE(TO_CHAR(arrival_date, 'MON-YYYY'), 'DEC-2009', counter_seq)) Dec09,
      3  COUNT(DECODE(TO_CHAR(arrival_date, 'MON-YYYY'), 'JAN-2010', counter_seq)) Jan10,
      4  COUNT(DECODE(TO_CHAR(arrival_date, 'MON-YYYY'), 'FEB-2010', counter_seq)) Feb10
      5  FROM table_1
      6  GROUP BY DECODE(exclusion_type,NULL,'NULL','NOT NULL');
    
    EXCLUSIO      DEC09      JAN10      FEB10
    -------- ---------- ---------- ----------
    NULL              4          4          4
    NOT NULL          3          5          4
    
    SQL> 
    
  • I was charged $19.99 each month for Amnesty International and the Ps should come free.  But he said that my free trial is over.  I need to turn in my homework as soon as possible tonight. Can you please install Ps CC for me.

    Can you please install my program Ps I was charge $19.99 each month last September.  Initially, I myself have subscriber but I heard that PS should come free along too.  I need tonight the cc of photoshop.

    > Heard Ps should come free

    I know not where 'heard you' that, but Photoshop does not include Illustrator, you need an additional subscription

    Cloud Plans https://creative.adobe.com/plans

    -Special photography Plan includes Photoshop & Lightroom and Bridge & Mobile Lightroom

    These forums are open 24/7 but Adobe support is not

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • I have run this query to get the result as below, but, even if my query is running fine, that I do not get the expected result.

    I'm looking for only column compare to my same target table as a table source.

    My query:


    Select case when column_name_s is null and column_name_t is not null

    then "alter table GRADE_CONVERSION drop | column_name_t | ';'

    When column_name_s is not null and column_name_t is null

    then "alter table GRADE_CONVERSION add | column_name_s | ' ' || data_type_s | « ; »

    else 'alter table modify GRADE_CONVERSION | column_name_t | ' ' || data_type_t | « ; »

    alterations of the end

    from (select s.column_name column_name_s, t.column_name column_name_t,

    s.data_type data_type_s, t.data_type data_type_t

    (select column_name, column_id, data_type

    of all_tab_cols@database

    where owner = 'erhan.

    and table_name = "GRADE_CONVERSION."

    + 1

    full outer join

    (select column_name, column_id, data_type

    of all_tab_cols@database

    where owner = 'sarigul.

    and table_name = "GRADE_CONVERSION."

    + 6

    on s.column_name = t.column_name

    )




    Tables:



    Target table: table GRADE_CONVERSION in sarigul@database


    LETTER_GRADEVARCHAR2 (2)
    GRADE_POINTNUMBER (3.2)
    MAX_GRADENUMBER (3)
    MIN_GRADENUMBER (3)




    Table source: Table GRADE_CONVERSION in erhan@database

    LETTER_GRADEVARCHAR2 (2)
    GRADE_POINTNUMBER (3.2)
    MAX_GRADENUMBER (3)
    MIN_GRADENUMBER (3)
    CREATED_BYVARCHAR2 (30)
    CREATED_DATEDATE
    MODIFIED_BYVARCHAR2 (30)
    MODIFIED_DATEDATE



    want to see output that is similar to this * (please ignore the names of column here it's just a clear example :))


    ALTER table Target_table change BOOK_ID Varchar2 (4);

    ALTER table Target_table I addSBN_10 Varchar2(13), null;

    ALTER table drop TITLE Target_table;

    Erhan_toronto wrote:

    1.I used src.nullable src_nullable and tgt.nullable tgt_nullable but only show Yes as below: but want to see the result as not null or null

    ALTER table TEST_TARGET change the NUMBER of MAX_GRADE (3, 2) Yes

    Ok. So it's all about the Yes and the no decoding to Default Null or Not Null, isn't it?

    So, to test, change one of the table of sample for NOT NULL columns in the source table, and then run the following query:

    with src as
    (
      select src.table_name src_table_name, src.column_name src_col_name, src.data_type src_data_type, src.data_length src_data_len, src.data_precision src_data_precision, src.data_scale src_data_scale,
             src.nullable src_nullable
        from user_tab_columns src
       where table_name = 'TEST_SOURCE'
    ),
    tgt as
    (
      select tgt.table_name tgt_table_name, tgt.column_name tgt_col_name, tgt.data_type tgt_data_type, tgt.data_length tgt_data_len, tgt.data_precision tgt_data_precision, tgt.data_scale tgt_data_scale,
             tgt.nullable tgt_nullable
        from user_tab_columns tgt
       where table_name = 'TEST_TARGET'
    ),
    col_details as
    (
      select src.src_table_name, nvl(tgt.tgt_table_name, first_value(tgt_table_name) over(order by tgt_table_name nulls last)) tgt_table_name,
             src.src_col_name, src.src_data_type, src.src_data_len, src.src_data_precision, src.src_data_scale, src.src_nullable,
             tgt.tgt_col_name, tgt.tgt_data_type, tgt.tgt_data_len, tgt.tgt_data_precision, tgt.tgt_data_scale, tgt.tgt_nullable
        from src
        left outer join tgt
          on (
              src.src_col_name = tgt.tgt_col_name
             )
    )
    select *
      from (
            select case
                    when tgt_data_type != src_data_type or tgt_data_len != src_data_len or tgt_data_precision != src_data_precision or tgt_data_scale != src_data_scale or src_nullable != tgt_nullable
                      then 'alter table ' || tgt_table_name || ' modify ' || tgt_col_name || ' ' || src_data_type || ' (' ||
                      case when src_data_type in ('DATE') then null
                           else
                                case
                                  when src_data_type in ('VARCHAR', 'VARCHAR2')
                                    then nvl(to_char(src_data_len), ' ') || ') '
                                  else  decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')')
                                end
                      end
                      || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL')
                    when tgt_col_name is null
                      then 'alter table ' || tgt_table_name || ' add ' || src_col_name || ' ' || src_data_type ||
                      case when src_data_type in ('DATE') then null
                           else
                                case
                                  when src_data_type in ('VARCHAR', 'VARCHAR2')
                                    then nvl(to_char(src_data_len), ' ') || ') '
                                  else  decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')')
                                end
                      end
                      || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL')
                   end alter_statement
              from col_details
            )
    where alter_statement is not null;
    

    Erhan_toronto wrote:

    2. when I run below under user sarigul and erhan I get the result as OWNER, TABLE_NAME, COLUMN_NAME DATA_TYPE... I have a link between two users. They have access to two tables.

    • Select * from all_tab_columns

    where owner = 'erhan' and table_name = "TEST_SOURCE."

    • Select * from all_tab_columns

    where owner = 'sarigul' and table_name = "TEST_TARGET."

    Alright. This means that you both users are on the same database. Only change, you will have to do in the above query is so change user_tab_columns to all_tab_columns and add the OWNER predicate respectively with the clause.

  • Select the query to select the month range based on the current date.

    It's the database 10 g oracel.

    I want to choose two months of data in the table. But these two months should be based on the current date.

    For example.

    If I run the select query on July 7, 2013, then the query must ignore the current month being July 2013 and last month, which is June 2013 and it shoud select only may 2013 and April 2013.

    Can someone help me how to make this request.

    SELECT *.

    FROM my_table

    WHERE my_date > = TRUNC (ADD_MONTHS (sysdate,-3), 'MY') - first day of the month 3 months ago

    AND my_date< trunc(add_months(sysdate,-1),'mon')="" --="" first="" day="" of="" last="">

  • analytical query to select the next record

    Hi all
    I would like to ask the two table below correspond to the output.
    1.dev_wt 2.dev_map 3. output result

    To help more clearance, please see this image link: http://lh6.ggpht.com/_xL6eBqjW6Yo/TEqnSvlF_FI/AAAAAAAAB0U/i2sclnnaj6g/Untitled-3.jpg

    1 dev_wt
    PMS_COMP     PMS_I       PMS_PERF_D   PMS_WT   PMS_CREATION_D
    BBOARD     GICEQGROSS    04/01/2001     30     04/05/2001
    BBOARD     GICST_B       04/01/2001     5      04/05/2001
    BBOARD     SBGS_B        04/01/2001     65     04/05/2001
    
    BBOARD     GICEQGROSS    04/11/2001     30     04/15/2001
    BBOARD     GICST_B       04/11/2001     5      04/15/2001
    BBOARD     SBGS_B        04/11/2001     65     04/15/2001
    2 dev_map
    GS_CODE     GS_I_CODE    GS_I_ID  MD_ID   GS_START_DT    GS_END_DT
    GICEQGROSS   CIWL        304       15     01/04/1998     31/03/2004
    GICEQGROSS   CIWL        304       2     01/04/2004      31/03/9998
    GICST_B      GICST_B     3707      15     01/04/2000     31/12/9998
    SBGS_B       SBGS_B      2231      15     01/04/1992     30/09/2003
    SBGS_B       SBGS_B      564       15     01/10/2003     31/12/9998
    I would like to match PMS_I = GS_CODE to retrieve the GS_I_CODE and analytical assistance

    query to search for the next record.
    Because I need to select record GICEQGROSS PMS_PERF_D date and following
    GICEQGROSS save PMS_PERF_D of dev_wt table and put the result GS_WT_FR and GS_WT_TO output.

    The date is in the format YYYYMMDD
    PMS_WT is divided by 100

    * 3. Output result *.
    GS_I_ID    PMS_COMP     GS_I_CODE     GS_WT_FR     GS_WT_TO     GS_I_CALC
    304       BBOARD        CIWL          20010401     20010410     0.3
    3707      BBOARD        GICST_B       20010401     20010410     0.05
    5209      BBOARD        SBGS_B        20010401     20010410     0.65
    PMS_COMP is of dev_wt table
    GS_I_CODE is dev_map join of tables with dev_wt
    GS_WT_FR is dev_wt GS_START_DT table
    GS_WT_TO's dev_wt record table according GS_START_DT where PMS_I = 'GICEQGROSS. '

    Now my challenge is to select the next record in PMS_PERF_D using the query analysis. Below
    is my query...
    SELECT GS_I_ID, PMS_COMP, GS_I_CODE, GS_WT_FR, GS_WT_TO, GS_I_CALC
    FROM dev_wt (
     SELECT lead(PMS_PERF_D) over(partition by PMS_I order by PMS_PERF_D) as GS_WT_TO        
     FROM dev_wt where PMS_I ='GICEQGROSS')
    left join dev_map on PMS_I = GS_CODE ;
    Thank you

    Edited by: WinZone 24 July 2010 16:46

    Edited by: WinZone 24 July 2010 16:50

    Hello

    This should be good:

    SELECT DISTINCT t2.gs_i_id, pms_comp, t2.gs_i_code,
                    TO_CHAR
                       (MIN (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i),
                        'yyyymmdd'
                       ) gs_wt_fr,
                    TO_CHAR
                       (MAX (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i) - 1,
                        'yyyymmdd'
                       ) gs_wt_to,
                    pms_wt / 100 gs_i_calc
               FROM dev_wt t1, dev_map t2
              WHERE t2.gs_code = t1.pms_i
    

    REM note even as odie: should be "2231" instead...

  • You want to know what ipad I need to run Apple Sound that for the scene.

    Sing Gospel music to the tracks on the CD.  You want to know which ipad should I get to run Apple Sound that to the scene.  That's all I'll use it for, so don't care about movies, phone, games, navigation, or much else. . She was told that 16 GB would be enough to hold 500 songs and IOS 7 need to run its what. If need one for this application. Don't know much to this topic, so really need help.

    Thanks Bill

    All the new iPad will run iOS 9 now. It would take a 16 GB iPad. I have 425 songs on my iPad, and they represent 1.8 GB of storage. But... You cannot add storage to an iPad, then you may want to consider eating less up to 32 GB. You never know what you could want on the road.

  • Wireless zero configuration does not start automatically. I need to run it whenever I restart the computer

    Wireless zero configuration does not start automatically.i have to start whenever I restart the computer. I have a laptop dell inspiron

    Moved from feedback

    Original title: WiFi

    Hello

    1. what version of Windows is installed on the computer?

    2. is it works much earlier?

    3 have there been recent changes made on the computer before the show?

    To activate the Configuration service automatic wireless so it starts automatically, click the Start button. Select settings , then select Control Panel.

    If you use Windows XP display, select the performance and Maintenance category, and then select Administrative Tools.

    If you use Classic view, and then select Administrative Tools. In the left pane, click the Services icon. Click the automatic Wireless Configuration icon in the right pane, and change the box Startup Type to Automatic.

    This parameter will be defined the service starts automatically at boot time. Then click on the Start button to start the Wireless Auto Configuration service zero wireless and click on the OK button.

    The automatic Wireless Configuration can also be started and stopped from a command prompt.

    To start the automatic Wireless Configuration, run the following command:

    net start wzcsvc

    To stop the automatic Wireless Configuration, run the following command:

    net stop wzcsvc

    For more information, see the link.

    Wireless Zero Configuration Reference

    Please post back with the results and we will be happy to help you further.

  • Query to get the number of records

    Hi all

    I would get the number of records in all tables in a schema. I don't want to run select count (*) of < table name >, because there are nearly 400 paintings. So I need a generic quqeyr that will give the recordcount for all tables.

    Experts good help yourslef to tide me over.

    Do you need a specific account? Or an approximate count is sufficient? Do you use the RBO and CBO?

    If you use the CBO and want an approximate count, column NUM_ROWS USER_TABLES should give you what you want.

    If you need a specific account, you will have full scan all tables. You can automate this process via SQL dynamic, i.e.

    DECLARE
      l_cnt INTEGER;
    BEGIN
      FOR x IN (SELECT table_name FROM user_tables)
      LOOP
        EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || x.table_name INTO l_cnt;
        dbms_output.put_line( 'Table ' || x.table_name || ' has ' || l_cnt || ' rows.' );
      END LOOP;
    END;
    

    Lawrence was also a [solution based on XML Query | http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html] to count all the rows in each table in a schema.

    Justin

  • query to find the number of dates

    Hi all

    I need assistance in creating a query. Ask the details I have given below.

    Table:

    Create the table emp_record (emp_id number, emp_join_date date);

    insert into emp_record values (1, 1 June 14 ');

    insert into emp_record values (2, 26 May 14 ');

    insert into emp_record values (3, 16 May 14 ');

    insert into emp_record values (4, 14 May 14 ');

    Suppose I ran the query with sysdate, we need to subtract the date of sysdate, then a report should be prepared in function number how many have subtracted values sysdate below 0 to 3 days, 3-6 date.

    Output should be like

    0 - 3 3-6 6-9 days more than 9 days

    1              0             1                    2

    Please help to write this query. Thank you

    Hello

    Do not essentially repeat the same CASE expression with the same types of calculations for each column.  You can do the job with a CASE expression, like this:

    WITH got_group_id AS

    (

    SELECT THE CHECK BOX

    WHEN emp_join_date< trunc="" (sysdate)="" -="" 8 ="" then ="">

    WHEN emp_join_date< trunc="" (sysdate)="" -="" 5 ="" then ="">

    WHEN emp_join_date< trunc="" (sysdate)="" -="" 2 ="" then ="">

    0 OTHERWISE

    Group_id END AS

    Of emp_record

    WHERE emp_join_date<= sysdate ="" --="" if="">

    )

    SELECT *.

    OF got_group_id

    PIVOT (COUNT (*)

    FOR group_id IN (0 '0-2 days'

    , 3 AS a "3-5 days.

    6 as a "6-8 days"

    , 9 as "9 or more days.

    )

    )

    ;

    It will be much easier to maintain when needs change.

    ED mentioned, using a string, 1 June 14 ' in a place where we expect a date is just a matter of trouble.  2-digit years are too.

  • Query should return the number of records that do not match the values of the DB

    I have the SQL query in the IN clause that I have certain values to verify each year against DB. I need a query that should tell the number 1 for existing records and 0 to not exist records. I get only matched lines from now account. Help is very appreciated.

    sample

    number of values
    SAM 1
    CAT 0
    POOL 1
    JACK 1
    FUN 0


    Concerning
    Prakash.
    with search_for_values as (
    select 'SAM' name from dual
    union all select 'CAT' from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    union all select 'FUN' from dual
    )
    , search_in_tab as (
    select 'SAM' name from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    )
    select sfv.name
         , case when exists ( select null from search_in_tab sit where sit.name = sfv.name  ) then 1 else 0 end   cnt
    from search_for_values sfv
    

    Anton

Maybe you are looking for