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.

Tags: ColdFusion

Similar Questions

  • SQL query to get non-unique values

    Hello

    I'm using oracle 11g.

    I have a table (T1) with data below and you want to insert the value in another table (T2).

    CITY            STATE
    --------------- --
    San Francisco   CA
    Palo Alto       CA
    Sarasota        FL
    New York        NY
    Boston          NY
    Boston          CO


    A unique constraint on the city and the State of the columns are given in table 2.


    I want to filter non-unique records before inserting data in table 2 to avoid the UNIQUE constraint exception.


    Thus, in the example above, the query should display subfolders


    Boston          NY
    Boston          CO


    any ideas?


    Thank you

    Hello

    EmAar says:

    Sorry Chris/Frank, I should have been more specific.

    Here is an actual table data.

    description of the category

    Costumes of a1

    Costumes of a1

    Costumes of a1

    A9 crew sweats

    A9 crew sweats

    CK recreation Rep

    CK Rep Tees

    K9 Casual

    Formal K9

    K9 TRAIL RUNNING

    As you can see, the category A1 and A9 are duplicated with the same description. On the other hand, CK & K9 have different descriptions.

    I need a query to display CK & K9 because they have different descriptions against the same category.

    hope that make sense?

    It makes sense, but it's still vague; you really need to post CREATE TABLE and INSERT statements for entry and the exact result wish you get.from of these data.

    My best guess is that you want:

    SELECTED category

    OF THE real

    GROUP BY category

    After HAVING COUNT (DISTINCT description) > 1

    ;

  • 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

  • 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 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
    
  • get the unique values

    Hello world

    I want a little help to get some unique records in the table. I know that it can be very easy, but I don't know why I can't

    Please help me

    I'm working on Oracle 11 g DB and I use the plsql allround automation tool

    I want to give example so that it will be very easy to understand

    Table1 below.

    CREATE THE TABLE1 TABLE:

    (contract not null, number (10))

    number (10) client.

    delivery_type number (10));

    insert into table1 values (1,1,1);

    insert into table1 values 2.2.1;

    insert into table1 values (2,22,1);

    insert into table1 values (3.3.1);

    insert into table1 values (3,33,1);

    insert into table1 values (3,333,1);

    Select * from table1;

    CONTRACTCUSTOMERDELIVERY_TYPE
    1111
    2221
    32221
    4331
    53331
    633331

    as you can see for the contract 2 and 3 I get 2 & 3 lines (since the clients are different I agree we receive multiple contracts)

    but in that contract 2 and 3 I don't want that these contracts including a corresponding customers in another table with a type_code = "email".

    create the table2 table

    (customer number (10),)

    Type_Code varchar2 (10));

    insert into table2 values (22, 'EMAIL');

    insert into table2 values (33, 'EMAIL');

    insert into table2 values (333, 'EMAIL');

    Select * from table2;

    CUSTOMERTYPE_CODE
    122E-mail
    233E-mail
    3333E-mail

    now I want a query that gives me the result like this

    but I want the result like this

    CONTRACTCUSTOMERDELIVERY_TYPE
    1111
    22221
    33331
    433331

    I also want that contract 1

    So basically I want all contracts, but if all contracts were duplicated (2 or 3 lines), I wanted to choose only the customers that has the matching condition in another table.

    Something like this should work:

    WITH account as
    (SELECT t1.*, COUNT (*) (PARTITION BY contract) c FROM table1 t1)
    SELECT * FROM account c
    WHERE c = 1


    OR EXISTS (SELECT 1 from table2 WHERE customer = c.customer AND type_code = "E-MAIL address");

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

  • Query to get the previous value

    Hello guys,.

    I have a problem to do a simple Oracle's SQL query.

    I will give an example. Imagine a table (test) with the following data:

    DATE DEPRECIATION AMORTIZATION

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

    01/01/2013 1.00 1.00

    02/05/2013 1.00 2.00

    03/08/2013 1.00 3.00

    04/12/2013 1.50 4.50

    13/05/2013 1,00 5.50

    22/06/2013 1,00 6.50

    17/07/2013 1,00 7.50

    08/11/2013 1.00 8.50

    27/09/2013 1,00 9.50

    10/01/2013 0.50 10.0

    11/01/2013 1,00 12.0

    12/01/2013 1.00-13.0

    If I want to recover the accumulated depreciation from June to December, is simple:

    SELECT DEPRECIATION

    OF THE TEST

    WHERE DATE BETWEEN to_date ('01-06-2013 ',' DD - MM - yyyy")

    AND to_date ('01-12-2013 ',' DD - MM - yyyy")

    However, I would like to create a field that question to bring the accumulated depreciation of the

    previous month (month of May), without changing the WHERE clause. Where I work, we use views to make such a request, but the performance is terrible.

    Anyone know the solution to this problem or can offer some advice?

    1f7629cd-28fe-4FC3-9CA0-2a2e51824e79 wrote:

    Solomon, this is the result I want. However, in a dynamic way.

    I don't have a need to communicate their data.

    I think you speak WITH clause. You don't commit CREATE TABLE + INSERT, WITH the clause is a quick way to create your table on the fly. All you need is:

    Select t.*,

    accumulated_deprecation - prev_mon_accum_deprecation deprecation

    t

    where dt between to_date('01-06-2013','dd-MM-yyyy') and to_date('01-12-2013','dd-MM-yyyy')

    /

    Of course, you must change the table names and column in your names. I don't know what happened to your last post, but on this basis:

    SELECT m.dat_mov_patr,

    m.val_valor_real,

    m.val_depr_acumulada,

    m.val_depr_acumulada - m.val_valor_real

    OF mov_patrimonial m

    WHERE m.dat_mov_patr > to_date (January 3, 2005 ', "dd-MM-yyyy")

    /

    And it's all simple arithmetic - no need to use all functions. Column val_depr_acumulada accumulated disapproval of the month 1 to the current month. Column val_valor_real is the disapproval of the current month. Val_depr_acumulada - val_valor_real is therefore accumulated disapproval of the month 1 month.

    SY.

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

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

  • SQL: How to get the maximum value of loans

    I have to display cod_acct_no, amt_disbursed, bal_book in table LOAN_MAST and maximum version of table LOAN_SCHEDULE CTR_STAGE_NO amt_instal. in other words; amt_instal of the most ctr_stage_no of table LOAN_SCHEDULE to display with the other value of LOAN_MAST column.

    You could help me pls.

    Data from these two tables are provided below:

    Main table ready
    INSERT INTO loan_mast
    VALUES
    ('00057110000431  ',2000000,1010605.39)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110000291  ',3500000,1212038.57)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110000450  ',2000000,1179199.79)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057010001457  ',2000000,1555836.32)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057010001650  ',9500000,8060419.1)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110050065  ',2000000,1742388.45)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057010001947  ',2000000,1933540.07)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057110050213  ',2000000,1978588.06)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037010001104  ',6175000,3241694.48)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037010001766  ',12000000,11715781.01)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037300050025  ',7500000,7472981.78)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037210000694  ',6500000,6588648.16)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000087  ',5000000,4105246.38)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000129  ',5000000,3478303.49)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000141  ',5000000,3685293.79)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000246  ',5000000,4029883.61)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000268  ',5000000,4499322.1)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000322  ',5000000,4966885.32)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017300050014  ',7000000,6625970.85)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017300050036  ',5700000,5687617.61)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017300050047  ',7500000,7527560)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017240000050  ',4300000,4300000)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017210000449  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('03017180001733  ',500000,335164.83)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117110050071  ',700000,625123.9)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077300050011  ',1500000,1447149.08)
    /
    INSERT INTO loan_mast
    VALUES
    ('00927180002119  ',500000,441488.25)
    /
    INSERT INTO loan_mast
    VALUES
    ('01507150051043  ',700000,633340.47)
    /
    INSERT INTO loan_mast
    VALUES
    ('03317290050040  ',300000,273601.45)
    /
    INSERT INTO loan_mast
    VALUES
    ('01027150051360  ',200000,179240.42)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150052782  ',300000,270794.1)
    /
    INSERT INTO loan_mast
    VALUES
    ('01137110050082  ',2000000,1786359.87)
    /
    INSERT INTO loan_mast
    VALUES
    ('01107150050610  ',200000,191399.56)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117150051071  ',300000,271560.17)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001052  ',6800000,6609837.58)
    /
    INSERT INTO loan_mast
    VALUES
    ('01157010001078  ',450000,425069.61)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017180001173  ',700000,484447.94)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997120004696  ',93099,64369.52)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067010001654  ',285000,255579.7)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001063  ',7000000,6930746)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001105  ',7000000,6934246)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001138  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001116  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001161  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001150  ',7000000,7000000)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210001127  ',7000000,6930746)
    /
    INSERT INTO loan_mast
    VALUES
    ('00067110050043  ',700000,602416.77)
    /
    INSERT INTO loan_mast
    VALUES
    ('01147150052362  ',200000,178682.78)
    /
    INSERT INTO loan_mast
    VALUES
    ('01167150051647  ',75000,60057.01)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017150053252  ',150000,125205.66)
    /
    INSERT INTO loan_mast
    VALUES
    ('00917150050232  ',100000,91972.04)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017180003081  ',990000,663015.26)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997220000893  ',154160,138665.08)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017210000955  ',5000000,4510523.32)
    /
    INSERT INTO loan_mast
    VALUES
    ('00087150001049  ',1000000,904601.41)
    /
    INSERT INTO loan_mast
    VALUES
    ('01107010000288  ',300000,268703.55)
    /
    INSERT INTO loan_mast
    VALUES
    ('00087150001038  ',1000000,906085.9)
    /
    INSERT INTO loan_mast
    VALUES
    ('01107010000277  ',200000,184905.75)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017080050030  ',500000,450047.42)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037210000533  ',4000000,3346908.17)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117180000631  ',990000,712874.67)
    /
    INSERT INTO loan_mast
    VALUES
    ('02007180001216  ',990000,792437.11)
    /
    INSERT INTO loan_mast
    VALUES
    ('01957180000928  ',400000,320317.9)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037210000544  ',600000,518404.4)
    /
    INSERT INTO loan_mast
    VALUES
    ('01117110050060  ',1000000,893034.07)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037180001877  ',800000,640405)
    /
    INSERT INTO loan_mast
    VALUES
    ('01047150052651  ',320000,288850.72)
    /
    INSERT INTO loan_mast
    VALUES
    ('01027160050103  ',100000,79915.86)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150052759  ',150000,129601.15)
    /
    INSERT INTO loan_mast
    VALUES
    ('01057150051287  ',800000,723681.12)
    /
    INSERT INTO loan_mast
    VALUES
    ('03317290050021  ',400000,359312.25)
    /
    INSERT INTO loan_mast
    VALUES
    ('01157150051316  ',500000,452300.73)
    /
    INSERT INTO loan_mast
    VALUES
    ('00037150050598  ',700000,633221.03)
    /
    INSERT INTO loan_mast
    VALUES
    ('01047150052673  ',150000,129610.95)
    /
    INSERT INTO loan_mast
    VALUES
    ('01147150052384  ',400000,361840.54)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150052802  ',150000,130840.94)
    /
    INSERT INTO loan_mast
    VALUES
    ('01157150051338  ',300000,259202.22)
    /
    INSERT INTO loan_mast
    VALUES
    ('01057150051307  ',400000,361840.54)
    /
    INSERT INTO loan_mast
    VALUES
    ('00017110050160  ',500000,397640.38)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077150050910  ',100000,79915.86)
    /
    INSERT INTO loan_mast
    VALUES
    ('00057150050702  ',400000,360841.83)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017150053271  ',150000,119955.86)
    /
    INSERT INTO loan_mast
    VALUES
    ('01057150051329  ',400000,360029.85)
    /
    INSERT INTO loan_mast
    VALUES
    ('01067150002665  ',500000,452300.73)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077150050921  ',250000,225526.17)
    /
    INSERT INTO loan_mast
    VALUES
    ('00047150050693  ',200000,160494.64)
    /
    INSERT INTO loan_mast
    VALUES
    ('01077080050026  ',100000,91150.55)
    /
    INSERT INTO loan_mast
    VALUES
    ('01017150053293  ',150000,129675.2)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997040001950  ',2500000,2439161.01)
    /
    INSERT INTO loan_mast
    VALUES
    ('09997120004685  ',75000,51855.74)
    /
    Table of loan from schedule+:
    INSERT INTO loan_schedule
    VALUES
    ('00017080050030  ',1,12426.29)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017110050160  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017110050160  ',2,17702.2)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017180001173  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00017180001173  ',2,35116.22)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037150050598  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037150050598  ',2,18158.39)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037180001877  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037180001877  ',2,29122.98)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000533  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000533  ',2,144609.59)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000544  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00037210000544  ',2,17625)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00047150050693  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00047150050693  ',2,7331.21)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00057150050702  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00057150050702  ',2,10157.38)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00067110050043  ',1,20017.91)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001038  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001038  ',2,25940.56)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001049  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00087150001049  ',2,25940.56)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00917150050232  ',1,2937.5)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00927180002119  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('00927180002119  ',2,25083.02)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053252  ',1,5422.86)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053271  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053271  ',2,5422.86)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053293  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017150053293  ',2,4406.25)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017180003081  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017180003081  ',2,49664.37)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017210000955  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01017210000955  ',2,126967.14)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027150051360  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027150051360  ',2,5980.03)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027160050103  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01027160050103  ',2,3615.24)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052651  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052651  ',2,8125.9)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052673  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01047150052673  ',2,4406.25)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051287  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051287  ',2,20752.45)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051307  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051307  ',2,10376.23)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051329  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01057150051329  ',2,11960.05)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067010001654  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067010001654  ',2,6855.16)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150002665  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150002665  ',2,12970.28)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052759  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052759  ',2,4406.25)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052782  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052782  ',2,7618.03)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052802  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01067150052802  ',2,5422.86)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077080050026  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077080050026  ',2,2485.26)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050910  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050910  ',2,3615.24)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050921  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077150050921  ',2,6348.36)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077300050011  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01077300050011  ',2,23289.97)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000277  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000277  ',2,4550.62)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000288  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107010000288  ',2,7215.96)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01107150050610  ',1,5188.12)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050060  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050060  ',2,23528.29)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050071  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117110050071  ',2,16469.8)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117150051071  ',1,7782.17)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117180000631  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01117180000631  ',2,49664.37)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01137110050082  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01137110050082  ',2,47056.57)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01147150052362  ',1,5875)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01147150052384  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01147150052384  ',2,10376.23)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157010001078  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157010001078  ',2,10764.62)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051316  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051316  ',2,12970.28)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051338  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01157150051338  ',2,8812.5)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01167150051647  ',1,2711.43)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01507150051043  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01507150051043  ',2,18158.39)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01957180000928  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('01957180000928  ',2,14561.49)
    /
    INSERT INTO loan_schedule
    VALUES
    ('02007180001216  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('02007180001216  ',2,36039.68)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03017180001733  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03017180001733  ',2,25083.02)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050021  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050021  ',2,9833.81)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050040  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('03317290050040  ',2,7375.36)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997040001950  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997040001950  ',2,13864.94)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004685  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004685  ',2,3495.59)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004696  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997120004696  ',2,4339.15)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997220000893  ',1,0)
    /
    INSERT INTO loan_schedule
    VALUES
    ('09997220000893  ',2,3429.21)
    /
    Kind regards

    Yamen

    Hello

    When there is a WHERE clause, it always comes after the FROM clause. (Joints and their conditions are part of the FROM clause).
    Try this:

    WITH     got_rnum    AS
    (
         SELECT     cod_acct_no
         ,     amt_instal
         ,     ROW_NUMBER () OVER ( PARTITION BY  cod_acct_no
                                   ORDER BY          ctr_stage_no       DESC
                           ) AS rnum
         FROM    loan_schedule
    )
    SELECT     m.cod_acct_no, m.amt_disbursed, m.bal_book
    ,     r.amt_instal             AS high_amt_instal
    FROM     loan_mast     m
    JOIN     got_rnum     r     ON     r.cod_acct_no     = m.cod_acct_no
                        AND     r.rnum          = 1
    WHERE   m.cod_acct_stat = '8' ----------[this is condition is newly added to apply the same in production to fetch desired record]
    ;
    
  • 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

  • SQL Query to get the logged in username user name in the Fusion Applications?

    Hi team, can someone please provide, how to retrieve the currently logged in username / UserID in Fusion Applications R9? Reg Sridhar

    Please use this query:-select FND_GLOBAL. USER_GUID, FND_GLOBAL. Double user_name

Maybe you are looking for

  • Migration of files between the profiles of IMAP

    I created a new profile, when I had to change your web host provider. I can't my old messages on the original profile and in the news. Both are IMAP, and I followed the instructions, downloaded Add-ons, etc., recommended in the Ezine of Mozilla knowl

  • Finder does not not to stop

    3 days ago my iMac start to stop responding during shutdown. Is the finder.  the screen goes black but the cursor. and if I move the cursor I can get the dock bar and start programs, but the finder not working and after click right I see grayed text

  • my windows says that another computer is running in the same network with the same ip address, please contact

    Today morning when I opened my samsung mini, it displays a message that another computer is running on the same network with the same ip address please find a solution for this

  • date of entry of HTML5 and notifications for BlackBerry 10

    Hello I'm trying to develop the application for BlackBerry10 using html5and notification. When tested on emulator ripple,rendering in the form of the datetimepicker. But, he just a simple textbox control when I tested it on alpha dev 10 blackberry (O

  • wireless users

    Hi all I have this error message on cisco ISE 3315 when authenticate my wireless users. "Dynamic authorization failed: 11213 no response received from the network access device. I have a cisco ISE 3315 and my access point is a CISCO WAP4410N without