Need for SQL query to get the result.

Region

MonthTrx typeSummary of the resolution
AMERICAS-13 mayAdjustmentsFix
EMEA-13 mayAdjustmentsIncorrect
AMERICAS-13 mayCredit memoIncorrect
EMEA-13 mayInvoiceFix
AMERICAS-13 mayCredit memoFix
OFD-13 mayAdjustmentsFix
AMERICAS-13 mayInvoiceIncorrect
DVL-13 mayAdjustmentsFix
DVL-13 mayAdjustmentsFix
OFD-13 mayAdjustmentsFix

Above my Table and here is the result required. Similarly for other regions as well. Can someone help me with the SQL query?

RegionSummary of the resolutionSettingCredit memoInvoiceTotal general
AMERICASFix112
Incorrect0112

Like this?

SQL > select * from transaction_audit;

MTH TRX_TYPE REGION BOARD
-------- ------ ----------- ---------
AMERICAS-13 may SETTINGS CORRECT
EMEA-13 may INCORRECT ADJUSTMENT
AMERICAS-13 may CREDIT MEMO INCORRECT
EMEA-13 may INVOICE CORRECT
AMERICAS-13 may CREDIT MEMO CORRECT
OFD-13 may SETTINGS CORRECT
AMERICAS-13 may INVOICE INCORRECTE
LAD-13 may SETTINGS CORRECT
LAD-13 may SETTINGS CORRECT
OFD-13 may SETTINGS CORRECT

10 selected lines.

SQL > select region
2, resolution_summary
3, count (decode (trx_type, "ADJUSTMENTS", trx_type)) adjustments
4, County (decode (trx_type, 'HAVING', trx_type)) credit_memo
5, County (decode (trx_type, "BILL", trx_type)) Bill
transaction_audit 6
Group 7
8 by region
9, resolution_summary
10 Decree
11 by region
12, resolution_summary
13.

REGION TAKE ADJUSTMENTS CREDIT_MEMO INVOICE
-------- --------- ----------- ----------- ----------
CORRECT THE AMERICAS 1 1 0
0 1 1 INCORRECT AMERICAS
EMEA CORRECT 0 0 1
INCORRECT EMEA 1 0 0
DAL ADDRESS 2 0 0
OFD CORRECT 2 0 0

6 selected lines.

SQL >

Tags: Database

Similar Questions

  • Urgent need for sql query

    Hi all
    Sorry I can't speak English very well
    =======================
    I have a table that contains two columns
    table name: total_sal
    column name: hire_date
    column name: salary

    table syntax

    create table total_sal (hire_date date
    number (6.2)) of salary;
    _________________________________________
    Example of data in table format

    hire_date | salary
    01/01/2011 | 1000
    01/02/2011 | 2000
    01/05/2011 | 500
    01/09/2011 | 400


    I NEED a SQL QUERY to display the table, as in this example

    OF | TO|||||||||||| TOTALSALAY
    01/01/2011 | 01/02/2011 | 3000
    07/05/2011 | 01/09/2011 | 900
    |||||||||||||||||||||||||||||||||| 3900
    /* Formatted on 9/23/2011 10:14:40 AM (QP5 v5.149.1003.31008) */
    WITH t
            AS (SELECT TO_DATE ('1/1/2011', 'mm/dd/yyyy') hire_date, 1000 salary
                  FROM DUAL
                UNION
                SELECT TO_DATE ('2/1/2011', 'mm/dd/yyyy'), 2000 FROM DUAL
                UNION
                SELECT TO_DATE ('5/1/2011', 'mm/dd/yyyy'), 500 FROM DUAL
                UNION
                SELECT TO_DATE ('9/1/2011', 'mm/dd/yyyy'), 400 FROM DUAL)
    SELECT "From", "To", totalsalary
      FROM (SELECT hire_date "From",
                   LEAD (hire_date) OVER (ORDER BY hire_date) "To",
                   salary + LEAD (salary) OVER (ORDER BY hire_date) totalsalary,
                   ROW_NUMBER () OVER (ORDER BY hire_date) rn
              FROM t)
     WHERE MOD (rn, 2) = 1
    UNION ALL
    SELECT NULL, NULL, SUM (salary) FROM t
    
    From     To     TOTALSALARY
    1/1/2011     2/1/2011     3000
    5/1/2011     9/1/2011     900
              3900
    
  • SQL query to get the NULL records after the last matching flag

    I have a xx1 table with id and flag columns. So I want the data in this table, after the last flag matched. I want that data to id 7 in the rooms. Even if the id 2,3,5 are null flag 'Y' was at 6. ID so I need a query to get the data of the xx1 table after the last correspondence flag (from 7 to 9 id).

    SQL > create table xx1

    2 (identification number,

    3 flag varchar2 (10));

    Table created.

    SQL > insert into xx1 values (1, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (2, null);

    1 line of creation.

    SQL > insert into values xx1 (3, null);

    1 line of creation.

    SQL > insert into xx1 values (4, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (5, null);

    1 line of creation.

    SQL > insert into xx1 values (6, 'Y');

    1 line of creation.

    SQL > insert into values xx1 (7, null);

    1 line of creation.

    SQL > insert into values xx1 (8, null);

    1 line of creation.

    SQL > insert into values xx1 (9, null);

    1 line of creation.

    SQL > select * from xx1.

    FLAG OF THE ID

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

    1. IS

    2

    3

    4. IS

    5

    6. IS

    7

    8

    9

    9 selected lines.

    SQL >

    Hello

    user11164339 wrote:

    Hi Frank - when I run the query, I don't see the results data.

    I get

    FLAG OF THE ID

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

    7

    8

    9

    What you do differently?

  • IOM sql Query to get the status of the failed task

    Hello world

    We have an obligation as we need to get the status of a particular task (say Create User in OID - Completed\Rejected status resource) for the particular user. We are able to get the status of the provisioed of resources to the user but not the status of the special mission which is trigerred for the user.can someone put some light on it. We must have the SQL query to do this.

    Thanks in advance.

    Kind regards
    MKN

    Hello
    Use this query to get the status of the task, also check the cooments

    SELECT USR. USR_LOGIN, OSI. SCH_KEY, ANN. SCH_STATUS, STA. STA_BUCKET OF
    OSI, CHS, STA, MIL, TOS, PKG, OUEDRAOGO, USR, OBJ, OST
    WHERE OSI.MIL_KEY = MIL.MIL_KEY
    AND ANN. SCH_KEY = OSI. SCH_KEY
    AND STA. STA_STATUS = SCH. SCH_STATUS
    AND TOS. PKG_KEY = PKG. PKG_KEY
    AND MIL. TOS_KEY = TOS. TOS_KEY
    AND OUÉDRAOGO. USR_KEY = USR. USR_KEY
    AND OUÉDRAOGO. OST_KEY = OST. OST_KEY
    AND OST. OBJ_KEY = OBJ. OBJ_KEY
    AND OSI. ORC_KEY = OUEDRAOGO. ORC_KEY
    AND OBJ. OBJ_NAME = "User AD".
    AND OST. OST_STATUS = "Provisioning" - filter accordinglly
    AND STA. STA_BUCKET = 'pending' - filter accordinglly
    AND PKG. PKG_NAME = "AD User" - filter accordinglly
    AND MIL.MIL_NAME = 'System' - filter accordinglly Validation
    ;
    Thank you
    Kuldeep

  • Need a sql query to get several dates in rows

    Hi all

    I need a query to get the dates of the last 7 days and each dates must be in a line...

    but select sysdate double... gives a line...

    Output of expexcted

    Dates:

    October 1, 2013

    30 sep-2013

    29 sep-2013

    28 sep-2013

    27 sep-2013

    26 sep-2013

    Try:

    SQL > SELECT sysdate-7 + LEVEL FROM DUAL

    2. CONNECT BY LEVEL<=>

    3 * ORDER BY 1 DESC

    SQL > /.

    SYSDATE-LEVEL 7 +.

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

    October 1, 2013 13:04:52

    30 - Sep - 2013 13:04:52

    29 - Sep - 2013 13:04:52

    28 - Sep - 2013 13:04:52

    27 - Sep - 2013 13:04:52

    26 - Sep - 2013 13:04:52

    25 - Sep - 2013 13:04:52

    7 selected lines.

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

  • SQL query to get the numbers from 0 to 99

    How can we write a sql query to get values from 0 to 99... This should not come from any table
    SELECT LEVEL - 1
      FROM  DUAL
      CONNECT BY LEVEL <= 100
    /
    

    SY.

  • SQL query to get the items for which transactions have not been saved

    Hi people,

    Have a small doubt I want to compile a SQL query in the inventory where I get these items for what transactions do not have been recorded during a period of at least one specified number of days.

    The days might be 30 days or 2 months depends on. If I want to get those items for which no transactions were reported for lets say 30 days. Could someone give me an idea of how to go about this thing? I use r12. I came up with the following query, but it gives a lot of records. The commented parts of this query is only commented on


    SELECT DISTINCT msi.segment1,

    MSI. Description,

    MSI.primary_uom_code,

    MSI.inventory_item_id

    MSI mtl_system_items_b / *,.

    mtl_material_transactions mmt * /.

    WHERE / * msi.inventory_item_id = mmt.inventory_item_id

    AND msi.organization_id = mmt.organization_id

    AND NVL ((SELECT SUM (transaction_quantity)

    OF mtl_onhand_quantities

    WHERE inventory_item_id = msi.inventory_item_id),

    0) = 0

    AND TRUNC (mmt.transaction_date) < = SYSDATE - & D

    AND * / NOT EXISTS (SELECT *)

    OF mtl_material_transactions mmt

    WHERE msi.inventory_item_id = mmt.inventory_item_id

    AND msi.organization_id = mmt.organization_id

    AND TRUNC (mmt.transaction_date) < SYSDATE - & D);

    Hi fatimakhellil

    Try the following code and mark it as correct if your problem be resolved.

    SELECT DISTINCT msi.segment1,

    MSI. Description,

    MSI.primary_uom_code,

    MSI.inventory_item_id,

    MSI.organization_id,

    Ms.secondary_inventory_name,

    (select max (transaction_date) in the mtl_material_transactions where msi.inventory_item_id = inventory_item_id

    AND msi.organization_id = organization_id) last_transaction_date

    OF mtl_system_items_b msi.

    Ms. mtl_secondary_inventories

    WHERE ms.organization_id (+) = msi.organization_id

    AND msi.source_subinventory = ms.secondary_inventory_name (+)

    AND NOT EXISTS (SELECT *)

    OF mtl_material_transactions mmt

    WHERE msi.inventory_item_id = mmt.inventory_item_id

    AND msi.organization_id = mmt.organization_id

    AND mmt.subinventory_code = ms.secondary_inventory_name

    AND mmt.organization_id = ms.organization_id

    AND TRUNC (mmt.transaction_date) BETWEEN TRUNC (SYSDATE - & d) AND TRUNC (SYSDATE))

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

  • SQL query to get the range of Date values

    Hello

    The database is Oracle11i.

    I'm looking for a way to generate a list of the dates of a fixed date in the past (could be hardcoded) at the time of the day (sysdate).

    In other words, if the fixed date is June 19, 2011, and assuming today ' today is June 24, 2011 the SQL must be able to generate the

    Next: -.

    June 19, 2011
    June 20, 2011
    June 21, 2011
    June 22, 2011
    June 23, 2011
    June 24, 2011

    And the constraint is that I can not make any change to the database in question. I can only shoot a (SELECT) SQL query. NO.

    use time dimension type of approach (time dimension is not available here) and no procedure, etc. from PL/SQL. Is it possible?

    Thank you

    Jaimeen Shah wrote:
    Hello

    The database is Oracle11i.

    I'm looking for a way to generate a list of the dates of a fixed date in the past (could be hardcoded) at the time of the day (sysdate).

    In other words, if the fixed date is June 19, 2011, and assuming today ' today is June 24, 2011 the SQL must be able to generate the

    Next: -.

    June 19, 2011
    June 20, 2011
    June 21, 2011
    June 22, 2011
    June 23, 2011
    June 24, 2011

    And the constraint is that I can not make any change to the database in question. I can only shoot a (SELECT) SQL query. NO.

    use time dimension type of approach (time dimension is not available here) and no procedure, etc. from PL/SQL. Is it possible?

    Thank you

    SQL> def date_start = '13/11/2010'
    SQL> def date_end   = '22/11/2010'
    SQL> with
      2    data as (
      3      select to_date('&date_start', 'DD/MM/YYYY') date1,
      4             to_date('&date_end',   'DD/MM/YYYY') date2
      5      from dual
      6    )
      7  select to_char(date1+level-1, 'DD/MM/YYYY') the_date
      8  from data
      9  connect by level <= date2-date1+1
     10  /
    THE_DATE
    ----------
    13/11/2010
    14/11/2010
    15/11/2010
    16/11/2010
    17/11/2010
    18/11/2010
    19/11/2010
    20/11/2010
    21/11/2010
    22/11/2010
    
  • SQL query to get the desired result

    I have the array with the following values

    Account Functional currency Billing currency Amount Header 5
    101USDUSD10 h 00
    101USDCAD12 h 00
    102JPYUSD9 h 00
    102JPYCAD3.00
    102JPYSGD2.00

    If the account has one different inv_currencypar that the functional currency and then

    I have to summarize the amount in this account by viewing the billing currency

    If the account has more than one other inv_currencypar that the functional currency and then

    I have to summarize the amount in this account showing the functional currency as the currency of invoicing

    I need output like this:

    Account

    Functional currency Billing currency Total amount Header 5101USDCAD10:00 pm102JPYJPY2:00 pm

    Can we get over output in sql without writing pl/sql program?

    Hello

    According to your specific needs, here's a way:

    SELECT account

    functional_currency

    CASE

    WHEN 1 = COUNT (DISTINCT NULLIF (invoice_currency

    functional_currency

    )

    )

    THEN MAX (NULLIF (invoice_currency

    functional_currency

    )

    )

    Of OTHER functional_currency

    END AS invoice_currency

    The SUM of (amount) AS total_amount

    header5

    FROM table_x

    GROUP BY account

    functional_currency

    header5

    ;

    If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.

    Is it possible to have 2 (or more) of different functional_currencies in the same account?

  • SQL query to get the given result

    Hi friends

    My data in the table are given below

    user transaction_date transaction_type
    1 1st August 2011
    August 2, 2011 1 c
    1 3 August 2011
    1 b 3 August 2011
    1 August 4, 2011 a
    1 b 4 August 2011
    2 3 August 2011
    2 b 3 August 2011
    August 4, 2011 2 c
    2 b 4 August 2011
    2 August 5, 2011 a
    2 b August 5, 2011
    2 August 7, 2011 a
    2 b 7 August 2011

    I want the count for each user as, how many times he made a transaction type transaction immediately after 'b' type?

    As the output of above data should be

    number of users
    1 2
    2 3

    Thanks in advance :)

    Maybe (NOT TESTED).

    select "user",
           count(criteria) "count"
      from (select "user",
                   transaction_date,
                   transaction_type,
                   case when transaction_type = 'b'
                         and lag(transaction_type,1) over (partition by "user",transaction_date
                                                               order by transaction_date,transaction_type) = 'a'
                        then 1
                   end criteria
              from the_table
           )
     group by "user"
     order by "user"
    

    Concerning

    Etbin

  • SQL query to get the employee details for those who have the same salary

    Hi Experts,
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> WITH EMP AS
      2  (
      3  SELECT 1000 EMPNO,100 SAL FROM DUAL UNION ALL
      4  SELECT 1001,90 FROM DUAL UNION ALL
      5  SELECT 1002,80 FROM DUAL UNION ALL
      6  SELECT 1003,90 FROM DUAL UNION ALL
      7  SELECT 1004,100 FROM DUAL UNION ALL
      8  SELECT 1005,20 FROM DUAL UNION ALL
      9  SELECT 1006,10 FROM DUAL
     10  )SELECT * FROM EMP;
    
         EMPNO        SAL
    ---------- ----------
          1000        100
          1001         90
          1002         80
          1003         90
          1004        100
          1005         20
          1006         10
    
    7 rows selected.
    SQL>
    Desired output:
         EMPNO        SAL
    ---------- ----------
          1000        100
          1004        100
          1001         90
          1003         90
    Please suggest how to work on the request?

    Thank you

    Oh, try

    WITH EMP AS
        (
        SELECT 1000 EMPNO,100 SAL FROM DUAL UNION ALL
        SELECT 1001,90 FROM DUAL UNION ALL
        SELECT 1002,80 FROM DUAL UNION ALL
        SELECT 1003,90 FROM DUAL UNION ALL
        SELECT 1004,100 FROM DUAL UNION ALL
        SELECT 1005,20 FROM DUAL UNION ALL
        SELECT 1006,10 FROM DUAL
       )
    SELECT * FROM EMP WHERE SAL IN (
    SELECT SAL FROM (
    SELECT count(sal) OVER (PARTITION BY SAL ORDER BY EMPNO) SAL_CNT, SAL FROM EMP
    )
    WHERE  SAL_CNT >1)
    ORDER BY SAL DESC;
    
    EMPNO     SAL
    1004     100
    1000     100
    1003     90
    1001     90
    4 rows returned in 0.01 seconds
    

    * 009 *.

  • SQL query to get the dates between two dates

    Hello

    We have a chart with start date and end date... Now I need to get all the dates between the start date and end date...

    Table looks to below...

    Create the table date_table (start_date, end_date date);

    The table data will be as below:

    start_date end_date

    January 1, 2013 January 4, 2013

    February 1, 2013 February 3, 2013

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

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

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

    May 1, 2013 may 3, 2013


    I want a result like below...


    holiday_dates

    January 1, 2013

    January 2, 2013

    January 3, 2013

    January 4, 2013

    February 1, 2013

    February 2, 2013

    February 3, 2013

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

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

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

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

    May 1, 2013

    May 2, 2013

    May 3, 2013


    Can anyone help... ?

    Ramesh9158 wrote:

    Hello

    Your query will not work for our case...

    First... We do not know the number of rows in the table... If we cannot use the union...

    Second... hard coding of dates... but we do not know what could be that goes back in the table... it could be no matter what it takes not only as appearing to the interpreter...

    Hey riri.

    My code will work everywhere I use with with union all statement to create the example data.

    Try the query:

    -The main query

    Select d1 + row_number() over (partition by iden) - stopped by iden holiday 1

    Of

    connect by level<= d2="" -="" d1="" +="">

    and prior iden iden =

    and prior sys_guid() is not null

    ----

    Ramin Hashimzade

  • Dynamic SQL query to get the unique value of list in a column

    I have two tables: tblWorkers and tblSkills. tblWorkers has a column, skills, which is populated by a field of multiple-checkbox with one or more skill_IDs of tblSkills, so each tblWorkers.Skills consists of a list of one or more comma-delimited values. For any Skill_ID, I need to generate a list of all workers with the appropriate skills, so I tried to do something in the direction of SELECT WorkerName FROM tblWorkers WHERE IN of skills (skills, #FORM. Skill_ID #)... or WHERE skills (ListFind (skills, #FORM. Skill_ID #))... etc.? My results (once I have had data type mismatches of the road) return all workers, not just those with the desired skills. There must be an easy way to do... How people with a little more experience CF/SQL I do this?

    > each tblWorkers.Skills consists of a list of one or more comma-delimited values

    This is your problem. You store a list of values that you want to access power/query separately in a single column. You will have to burst in a separate table.
    TblWorkers

    TblSkills

    TblWorkerSkills
    mapping table of many workers with skills.

    If you do not change your data model now, you will constantly be butting your head against that.

Maybe you are looking for

  • won't open a new tab... IM by clicking on the +, but nothing happens

    So I have a laptop Dell XPS L702X (win7.64) and a surface of two Microsoft pro running the same version of FF same Favorites and everything. I went through all the settings on both and against all. Put both be exactly the same. But on my laptop (sinc

  • I can't uninstall Age of empires III. It is said it was removed, but still show on the control panal

    When I deleted the program, it shows that it is uninstalled and brings me to a page of Age of Empires III, which gives me an option to 'complete '.  Supposedly the game has been removed but still appears in the Panel control as the games installed.  

  • Need help to remove Quickset.

    I hope that I have come to the right place for this. I have an interesting question that I have been unable to solve. I have an Inspiron n5030, but the hard drive that I use is one that came out an Inspiron 1520. Power is out on this subject once aga

  • fatal error DirectX incountered

    What should I do to solve this problem with direct x

  • Recover password Cisco UC320W

    Dear forum, I'm having a problem with my connection to my UC320W administrator, I seem to have forgotten my password, even though I have a backup, but that will probably take me instead of the sample, I am now if I reset, can you please confirm if th