need help to write a conditional query recordset

I have two fields or not in the database. VeteranMarker and VeteranNoMarker. Answering one can be Y or N.
I want to write a statement for my detail page where there is a label "veteran? If VeteranMarker or VeteranNoMarker has a Y in the database, then I want to display "YES" next to the label of "veteran? If neither has a Y, then I want to say 'NO '.

The recordset is called DetailRS1, the fields would be so (I think) DetailRS1.VeteranMarker and DetailRS1.VeteranNoMarker.

I have no idea how to write a conditional statement to achieve this.

Thanks in advance,
Miriam

I think I have it solved. Here is the code, and it seems to work. If this is correct, I hope it can help someone else too.

Tags: Dreamweaver

Similar Questions

  • Need help to write a sub query

    Our environment - Oracle 10 g

    Hi all
    Need help to write a sub query to reach him here are examples of data using which iam trying to replace the value column in the table based on two other columns in the same table

    Examples of data

    ClaimNo flag LineNo Procedurecode
    100 01 N MN4567
    100 02 Y 7863
    100 03 N MN8976
    100 04 Y 9000
    101 01 Y 8954
    101 02 N MN6754
    101 03 N MN7654
    101 04 Y 8976
    102 01 Y 1234
    102 02 Y 2345
    102 03 Y 3456
    102 03 Y 4567

    Each column of ClaimNo has several rows of data. But if column procedurecode for a claimNo starts with MN then all values associated with the claimno for the flag column should replace N

    If the data must become like below

    ClaimNo flag LineNo Procedurecode
    100 01 N MN4567
    100 02 N 7863
    100 03 N MN8976
    100 04 N 9000
    101 01 N 8954
    101 02 N MN6754
    101 03 N MN7654
    101 04 N 8976
    102 01 Y 1234
    102 02 Y 2345
    102 03 Y 3456
    102 03 Y 4567


    Thank you

    See the example:

    with t as (
                  select 100 ClaimNo, '01' LineNo, 'N' Flag, 'MN4567' Procedurecode from dual
        union all select 100, '02', 'Y', '7863' from dual
        union all select 100, '03', 'N', 'MN8976' from dual
        union all select 100, '04', 'Y', '9000' from dual
        union all select 101, '01', 'Y', '8954' from dual
        union all select 101, '02', 'N', 'MN6754' from dual
        union all select 101, '03', 'N', 'MN7654' from dual
        union all select 101, '04', 'Y', '8976' from dual
        union all select 102, '01', 'Y', '1234' from dual
        union all select 102, '02', 'Y', '2345' from dual
        union all select 102, '03', 'Y', '3456' from dual
        union all select 102, '03', 'Y', '4567' from dual
    )
    select
        claimno,
        lineno,
        flag,
        case
          when count(decode(substr(procedurecode,1,2),'MN',1)) over(partition by claimno)>0
            then 'N'
          else flag
        end new_flag,
        procedurecode
    from t
    

    Kind regards
    Sayan M.

  • Need help to write a SQL query complex

    I have the source tabe as below

    -> SOURCE_TABLE
    NAME     CUST_ID     SVC_ST_DT     SVC_END_DT 
    TOM        1               31/08/2009      23/03/2011 
    DOCK       2               01/01/2004      31/05/2010 
    HARRY      3               28/02/2007      31/12/2009 
    I want to load as target table below
    -> TARGET_TABLE
    NAME     CUST_ID                     SVC_ST_DT      SVC_END_DT 
    TOM      1           31/08/2009      31/12/2009 
    TOM      1           01/01/2010      31/12/2010 
    TOM      1           01/01/2011      23/03/2011 
    DOCK      2           01/01/2004      31/12/2004 
    DOCK      2           01/01/2005      31/12/2005 
    DOCK      2           01/01/2006      31/12/2006 
    DOCK      2           01/01/2007      31/12/2007 
    DOCK      2           01/01/2008      31/12/2008 
    DOCK      2           01/01/2009      31/12/2009 
    DOCK      2           01/01/2010      31/05/2010 
    HARRY      3           28/02/2007      31/12/2007 
    HARRY      3           01/01/2008      31/12/2008 
    HARRY      3           01/01/2009      31/12/2009 
    Is it possible to write a SQL query that returns the data in the same way above the target table.

    Published by: AChatterjee on April 30, 2012 07:14

    Published by: AChatterjee on April 30, 2012 07:14

    Or like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'TOM' as NAME, 1 as CUST_ID, date '2009-08-31' as SVC_ST_DT, date '2011-03-23' as SVC_END_DT from dual union all
      2             select 'DOCK', 2, date '2004-01-01', date '2010-05-31' from dual union all
      3             select 'HARRY', 3, date '2007-02-28', date '2009-12-31' from dual)
      4  --
      5  -- end of test data
      6  --
      7  select name, cust_id, svc_st_dt, svc_end_dt
      8  from (
      9        select name
     10              ,cust_id
     11              ,greatest(svc_st_dt, add_months(trunc(svc_st_dt,'YYYY'),yr*12)) as svc_st_dt
     12              ,least(svc_end_dt, add_months(trunc(svc_st_dt,'YYYY'),(yr+1)*12)-1) as svc_end_dt
     13        from t
     14             cross join (select rownum-1 as yr
     15                         from   dual
     16                         connect by rownum <= (select extract(year from max(svc_end_dt)) - extract(year from min(svc_st_dt)) + 1 from t)
     17                        )
     18       )
     19  where svc_st_dt <= svc_end_dt
     20* order by 2, 3
    SQL> /
    
    NAME     CUST_ID SVC_ST_DT            SVC_END_DT
    ----- ---------- -------------------- --------------------
    TOM            1 31-AUG-2009 00:00:00 31-DEC-2009 00:00:00
    TOM            1 01-JAN-2010 00:00:00 31-DEC-2010 00:00:00
    TOM            1 01-JAN-2011 00:00:00 23-MAR-2011 00:00:00
    DOCK           2 01-JAN-2004 00:00:00 31-DEC-2004 00:00:00
    DOCK           2 01-JAN-2005 00:00:00 31-DEC-2005 00:00:00
    DOCK           2 01-JAN-2006 00:00:00 31-DEC-2006 00:00:00
    DOCK           2 01-JAN-2007 00:00:00 31-DEC-2007 00:00:00
    DOCK           2 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00
    DOCK           2 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00
    DOCK           2 01-JAN-2010 00:00:00 31-MAY-2010 00:00:00
    HARRY          3 28-FEB-2007 00:00:00 31-DEC-2007 00:00:00
    HARRY          3 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00
    HARRY          3 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00
    
    13 rows selected.
    
  • Need help to write the SQL query

    Hello
    Please help me to write a query. My requirement is as below.

    Hello
    I have a table say XYZ in the following format.

    product_id local min_order_quntity
    ========================================
    1 en 10
    1 ch 10
    2 en 20
    2 ch 20
    3 en 30
    3 ch 30
    4 en 40
    4 NC 10

    Now I want to find the product_id where min_order_quantity is different for cn and locale

    now I want the result of the following

    product_id local min_order_quantity
    =============================================
    4          en          40
    4 ch 10

    This is different for local in and cn for product_id 4 min_order_quantity

    min_order_quantity should be the same for both the locale(en,ch) for any product_id.

    I want to find the product_id where min_order_quantity is different for ch and fr local

    Thank you..

    Hello

    This query should do the job

    select * from xyz t1
    where exists ( select 1 from xyz t2 where t2.product_id = t1.product_id and
                   t2.locale != t1.locale and t2.min_order_quantity != t1.min_order_quantity );
    

    See you soon

  • Need help to write a MySQL query that returns only the peer matching records

    Because I don't know how to explain it easily, I use the table below as an example.

    I want to create a MySQL query that returns only the records that match counterparts where 'col1' = 'ABC '.

    Notice the ' ABC / GHI' record does not have a Counter-match ' GHI / ABC' record. This record must not be returned because there is no Counter-Party correspondent. With this table, the ' ABC / GHI' record should be the one returned in the query.

    How can I create a query that will do it?


    ID | col1 | col2
    --------------------
    1. ABC | DEF
    2. DEF | ABC
    3. ABC | IGS
    4. DEF | IGS
    5. IGS | DEF


    * Please let me know if you have no idea of what I'm trying to explain.

    I wanted to just the results where col1 = ABC, but I already got the answer I needed on another forum. Thank you anyway.

    SELECT a.col1,
    a.col2
    FROM table_name AS a
    LEFT OUTER
    Table_name JOIN b
    ON b.col1 = a.col2
    AND a.col1 = b.col2
    WHERE b.col1 IS NOT NULL AND a.col1 = 'ABC '.

  • I need help to write a script that detects the first instance of a paragraph style and then change

    I need help to write a script that detects the first instance of a paragraph style and then he goes to a different paragraph style.  I don't necessarily need someone to write all this, by the biggest problem is to find how to find just the first instance of the paragraph style.  Any help would be greatly appreciated, thank you!

    Hello

    then try this with your active doc:

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

    myDoc var = app.activeDocument;

    mStyle var = myDoc.paragraphStyles.item ("PS_NameToFind"); change the name to paraStyle

    var mStyle_1 = myDoc.paragraphStyles.item ("PS_NameToChange"); change the name to paraStyle

    var mFrames = myDoc.pages.everyItem ().textFrames.everyItem () .getElements ();

    app.findTextPreferences = null;

    app.findTextPreferences.appliedParagraphStyle = mStyle;

    for (var k = 0; k)< mframes.length;="">

    {

    currFound = mFrames [k] .findText ();

    If (currFound.length > 0)

    currFound [0] .paragraphs [0] .appliedParagraphStyle = mStyle_1;

    }

    app.findTextPreferences = null;

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

    Rgds

  • Need help to create a conditional LOV function

    First off the coast to let put me the warning that I am not the right Wick informed in PL/SQL. I need to use the LOV conditional for a list of selection based on the user's role in this application.

    I use the example of samples of the Dene - link: [http://apex.oracle.com/pls/otn/f?p=31517:120:2954663700615140:NO]

    I created the 2 types required and tested the function with a simple select query and LOV works.

    However, I need the function to return values based on the user role. I know, it's probably the ugliest pl/sql, you may have seen yet ;) I hope that you guys can decipher the logic that I use. Obviously, this code does not validate.

    You guys could help me with this?
    CREATE OR REPLACE FUNCTION return_art_lov_fn
    RETURN art_table_type
    AS
      v_data   art_table_type := art_table_type ();
    BEGIN
    IF
    EXISTS (SELECT '1'FROM GBL_PEOPLE, GBL_ACCESS WHERE upper(gbl_people.userid) = upper(app_user) AND gbl_people.person_id = gbl_access.person_id and gbl_access.art_role = 9)
    THEN
    FOR c IN (SELECT reverse_name, person_id
                   FROM gbl_people)
       LOOP
          v_data.EXTEND;
          v_data (v_data.COUNT) := art_rectype (c.person_id, c.reverse_name);
       END LOOP;
    ELSE
    FOR c IN (select reverse_name,person_id from GBL_PEOPLE where upper(userid) = upper(APP_USER) and current_flag is not null
               union
              select reverse_name,person_id from GBL_PEOPLE where mgr_person_id =(select person_id from GBL_PEOPLE where upper(userid) = upper(APP_USER) and
               current_flag is not null) and current_flag is not null)
       LOOP
          v_data.EXTEND;
          v_data (v_data.COUNT) := art_rectype (c.person_id, c.reverse_name);
       END LOOP;
    ENDIF;
       RETURN v_data;
    END;
    -Vinod

    Published by: user4908943 on December 10, 2009 16:37

    Published by: user4908943 on December 10, 2009 16:40

    Published by: user4908943 on December 10, 2009 16:41

    Published by: Jeremy on December 11, 2009 04:34
  • Need help to write sql query

    I am trying to write the SQL for a single recordset.

    I have a table with all the info from the standard article and an item_colorID.

    I have a table with 2 columns, item_colorID and color_ID color_lookup

    I have a table with 2 columns, color_ID colors and color

    I want to join the tables and filter it so that a repeat region shows dynamic data by the name of article, thumb, description, price

    and also a dynamic list/menu populated by color

    filtered so that each element is in the list/menu only available element colors.

    I have tried different variations of this sql

    SELECT * items INNER JOIN color_lookup ON color_lookup.item_colorID = items.item_colorID INNER JOIN colors ON colors.color_ID = color_lookup.color_ID WHERE items.itemCatID = 3 ORDER BY items.itemName

    but the list/menu shows each color choice, multiplied by the number of items in this color

    That is to say white will show 80 + times.

    Thanks for your help,

    Jim balthrop

    Hi JB, I think I understand the situation, but of course, I'm not familiar with the interface of the cart software you are using. It seems that you will not be able to use the choice "research from the recordset" because the color is a different Recordset. You can't really understand the color in the main recordset because it would cause the main repeating region show the item once for each available color, which is not what you want.

    I also see that the drop-down color is in its own form. If you have placed this process in the main form, would be the behavior recoginize it and treat it differently? In other words, the cart accepts entry options outside the main form element it uses:

    
    

    I don't know that the shopping cart software contains other methods to add to the cart you can be forced to use.

    What shopping cart software are you helping? They have a forum which you could get more targeted assistance?

  • Need help to write the query to extract the value of the previous row - Lag not help


    Hello

    I created follwing table.

    Create table test

    (number of fi,

    number of fo_fv

    number of jup_fv

    action varchar2 (10)

    );

    insert into TEST(1,1,1,'LOAD');

    Insert into TEST (2, NULL, 2, "ROLL");

    insert into TEST(3,,3,'ROLL');

    insert into TEST(4,,4,ROLL);

    insert into TEST (5,2,5,LOAD);

    I want the result of the query as below:

    FI FO_FV JUP_FV ACTION

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

    1          1                    1                    LOAD

    2          1                    2                    ROLL

    3          1                    3                    ROLL

    4          1                    4                    ROLL

    5          2                    5                    LOAD

    Help, please.

    Thank you!

    SQL > select fi
    2, max (fo_fv) on fo_fv (fi control)
    3, jup_fv
    4, action
    5 of the test;

    FI FO_FV JUP_FV ACTION
    ---------- ---------- ---------- ----------
    1 1 1 LOAD
    ROLL OF 2 1 2
    3 1 3 ROLL
    4 1 4 ROLL
    5 2 5 LOAD

    OR

    SQL > select *.
    2 test
    model 3
    Dimension 4 by (fi)
    5 measures (fo_fv, jup_fv, action)
    6 rules
    7   (
    8 fo_fv [any] = case when fo_fv [cv ()] is null
    9. can fo_fv [cv () - 1]
    10 fo_fv [cv () else]
    11 end
    (12);

    FI FO_FV JUP_FV ACTION
    ---------- ---------- ---------- ----------
    1 1 1 LOAD
    ROLL OF 2 1 2
    3 1 3 ROLL
    4 1 4 ROLL
    5 2 5 LOAD

  • Need help to write a better SQL query

    Hi gurus,

    Please let me know your best query for the problem below:

    Suppose we have 2 tables in Oracle 10 G database:

    IM1: product and warranty sales records

    A: sales_id

    B: product QTY.

    C: quantity of product

    D: Service QTY.

    E: Service amount

    IM1 table:

    a b c d and e

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

    1 1 100 1 10

    2 1 150 1 70

    3 2 500 1 100

    4 1 100 0 0

    IM2: brand and product guarantee service term associated with record sales

    A: sales_id

    G: the Service life

    P: brand product of

    Z: flag of product/Service

    IM2 table:

    a    g               p          z

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

    1 sony NULL p

    1 monthly NULL g

    Dell 2 p, NULL reference

    Reg 2 g NULL

    NULL lenovo 3 p

    3 monthly NULL g

    Sony NULL 4 p

    Then, he must bring the "term of Service" and "Brand product" in line with the sales table, as below:

    ID h_qty h_amnt g_qty g_amnt brand term

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

    1 1 100 1 10 sony monthly

    2 1 150 1 70 dell Reg

    3 2 500 1 100 lenovo monthly

    4 1 100 0 0 sony NULL

    What I wrote myself is as below, but I want to know if there is a better idea to make the query more reliable, because real paintings are big and my query is slow.

    SELECT DISTINCT

    ID of the s.a,

    s.b h_qyt,

    s.c. h_amnt,

    Virginia g_qty,

    Sager g_amnt

    brand of the PDP,

    term of r.g

    Of

    (SELECT s.*, PDP FROM s im1, im2 p WHERE s.a = p.a. PDP AND IS NOT NULL).

    IM2 p,

    IM2 g

    WHERE s.a. = p.a.

    AND s.a. = g.a

    AND (p.z = 'p' AND WINS = 'g')

    OR (p.z = 'p' AND WINS = 'p' AND sagehomme = 0 AND s.p = pp)

    ORDER BY 1;

    Here you will find the table scripts:

    create table im1 (a number, b, c number, number d, e number);
    create table im2 (a number g char (10), char (10) p, z (1) tank);
    insert into values im1 (1,1,100,1,10);
    insert into values im1 (2,1,150,1,70);
    insert into values im1 (3,2,500,1,100);
    insert into values im1 (4,1,100,0,0);

    Insert in im2 values (1, null, 'sony', 'p');
    Insert in im2 values (1, 'Monthly', null, 'g');
    Insert in im2 values (2, null, 'dell', 'p');
    Insert in im2 values (2, 'Reg', null, 'g');
    Insert in im2 values (3, null, 'lenovo', 'p');
    Insert in im2 values (3, 'Monthly', null, 'g');
    Insert in im2 values (4, null, 'sony', 'p');

    something like below

    Select x.a as id, x.b as h_qty, x.c as h_amnt, Eliane as g_qty, x.e as g_amnt, min (y.p) as min (y.g) as mark

    -min (y.p) compared to (x.a partition) as min (y.g) on (x.a partition) as the term mark
    of im1, im2 XY
    where x.a = y.a
    Group of x.a, x.b, x.c, Eliane x.e

    Edited: putting aggregation function instead of the function min min Analytics

  • Need help with rewrite of a query

    Hi friends,

    PFB the query and the result. Please ignore where the conditions, they are only about 50% accurate.

    SELECT XMLELEMENT ( 'majorLine' XMLATTRIBUTES ( ) d. ) line_id AS "Row Id" ),

    xmlforest (d. ) ordered_item as "itemName" , 

    d . ordered_quantity as 'quantity' ),

    (SELECT XMLAGG (XMLELEMENT ()"Service" XMLATTRIBUTES (e. ))) line_id AS Service ),

    ( ) SELECT XMLAGG (XMLELEMENT ( "ServiceName" ))

    XMLATTRIBUTES (of. ) ordered_item AS "ItemName" ),

    xmlforest (of. ) ordered_item as "itemName" , 

    de . ordered_quantity as 'quantity' )))

    DE oe_order_lines_all of

    de . line_id = e. line_id et de . link_to_line_id is null ))) 

    DE oe_order_lines_all e

    e. line_id = 143424538 ),

    (SELECT XMLAGG (XMLELEMENT ()"minorLine" XMLATTRIBUTES (e. ))) line_id AS minorLine ),

    ( ) SELECT XMLAGG (XMLELEMENT ( "itemName" ))

    XMLATTRIBUTES (of. ) ordered_item AS "ItemName" ),

    xmlforest (of. ) ordered_item as "itemName" , 

    de . ordered_quantity as 'quantity' )))

    DE oe_order_lines_all of

    de . line_id = e. line_id )))

    DE oe_order_lines_all e

    ( e. line_id = 143424538 ), (SELECT XMLAGG (XMLELEMENT ()"service" XMLATTRIBUTES (e. ))) line_id AS Service ),

    ( ) SELECT XMLAGG (XMLELEMENT ( "serviceName" ))

    XMLATTRIBUTES (of. ) ordered_item AS "itemName" ),

    xmlforest (of. ) ordered_item as "itemName" , 

    de . ordered_quantity as 'quantity' )))

    DE oe_order_lines_all of

    de . line_id = e. line_id et de . link_to_line_id is null ))) 

    DE oe_order_lines_all e

    ( e. line_id = 143424538 ( )

    ( ) YOU "dept_list"

    DE oe_order_lines_all d d . line_id = 143424538 ;



    The output is:


    < majorLine Line Id='143424538'>

    < itemName > 15454-TCC3-K9 = </ itemName >

    < quantity > 10 < / quantity >

    < Service SERVICE='143424538'>

    < ServiceName ItemName'15454-TCC3-K9 ='=>

    < itemName > 15454-TCC3-K9 = </ itemName >

    < quantity > 10 < / quantity >

    </ ServiceName >

    </ Service >

    < minorLine MINORLINE='143424538'>

    < itemName ItemName'15454-TCC3-K9 ='=>

    < itemName > 15454-TCC3-K9 = </ itemName >

    < quantity > 10 < / quantity >

    </ itemName >

    </ minorLine >

    < service SERVICE='143424538'>

    < serviceName itemName'15454-TCC3-K9 ='=>

    < itemName > 15454-TCC3-K9 = </ itemName >

    < quantity > 10 < / quantity >

    </ serviceName >

    </ service >

    </ majorLine >

    But the production expected as below

    < majorLine Line Id="143">

    < itemName > 15454-K = </ itemName >

    < quantity > 10 < / quantity >

    < Service >

    < lineId >143424538 < / lineId >

    < itemName > 15454-9 = </ itemName >

    < quantity > 10 < / quantity >

    </ Service >

    < minorLine MINORLINE='143424538'>

    < itemName > 1549 = </ itemName >

    < quantity > 10 < / quantity >

    </ minorLine >

    < service >

    < lineId >143424538 < / lineId >  

    < itemName > 159= </ itemName >

    < quantity > 10 < / quantity >

    </ service >

    </ majorLine >



    So the exact structure of XML output will be like that. In the example above, I didn't add the service of minors and several minor lines.

    I need to change the code above in the format below.



    < majorLine = "123456" LineID >-> there will be only one line of Major

    < itemNamme > MajorLineItem < / itemName >

    < quantity > 2 < / quantity >

    < service > -> there may be more than one service or no service of this major axis

    < > < lineId > 123456 lineId

    < itemNamme > serviceOfmajor < / itemName >

    < quantity > 2 < / quantity >

    < / service >

    < minorLine LineID '456789' = > -> there are several minor this major line lines

    < itemNamme > first_MinorlineItem < / itemName >

    < quantity > 7 < / quantity >

    < service >-> there may be more than one or NONE of the lines of service for one minor line

    < > < lineId > 11212 lineId

    < itemNamme > First_serivceOfMinor < / itemName >

    < quantity > 2 < / quantity >      

    < / service >

    < service >-> it may be more than one service lines for a line of minor

    < > 1347657 < lineId > lineId

    < itemNamme > second_serivceOfMinor < / itemName >

    < quantity > 2 < / quantity >      

    < / service >

    < minorLine LineID = "477838" > -> there are several minor this major line lines

    < itemNamme > second_MinorlineItem < / itemName >

    < quantity > 3 < / quantity >

    < / majorLine >



    Please help me to re - write the code. I used the approach of DOM node, its very long, I'm trying to replace it. Help, please. Let me know if you have any questions.


    Thank you and best regards,

    Arun Thomas T





    Not a Constructive Question.

  • Need help to write a program for the acquisition of signals.

    Hello

    I need to write a program that will do the following:

    1 acquire two signals simulated,

    2. make 10 averages the signal,

    3. filter the signal,

    4. display the signal in its raw form and the power spectrum (fft),

    5. save the data using writing to the file vi

    I tried it for awhile, but there's always something does not... None of the experts LabVIEW here can help me?

    Thank you 1 million.

    -Deet

    No one here is going to do your homework for you. Please join what you have written so far and explain the specific problem that you are experiencing.

  • Please help to write a complex query "select".

    Hello

    I am trying to write a query that retrieves information about attachments in HP ALM by referring to TestInstances, TestRun and TestSteps tables. For those who do not know HP ALM...

    I'm describing the structure of data in these tables (the names of tables and fields are changed for easy understanding).

    > > 1. In the "TestInstances" table key fields are I_InstanceID, I_HasAttachments and I_TestSetID

    1.1 I_InstanceID is the primary key for this table

    > > 2. Key in the table "TestRuns" fields are R_RunID, R_InstanceID, R_RunTime and R_HasAttachments

    2.1 R_RunID is the primary key for this table

    2.2 R_InstanceID is a foreign key to I_InstanceID in the TestInstances table

    2.3 all I_InstanceID in the TestInstances table may not have an entry in the table TestRuns

    2.4 an I_InstanceID in TestInstances can have multiple entries in the table TestRuns with different R_RunID

    > > 3. In the "TestSteps" table key fields are S_StepID, S_RunID and S_HasAttachments

    3.1 S_StepID is the primary key for this table

    3.2 S_RunID is a foreign key to R_RunID in the TestRuns table

    3.3 all R_RunID in the TestRuns table may not have an entry in the TestSteps table

    3.4 a R_RunID in TestRuns can have multiple entries in the table TestSteps with different S_StepID

    Entry to the query I want to write is a set of I_TestSetID in the TestInstances table (which I already have)

    The desired query output is -.

    1. all I_InstanceID have the values as shown in the entry I_TestSetID

    2 I_HasAttachments corresponding to I_InstanceID

    3. Earl of R_RunID against each I_InstanceID (may be 0 or a positive integer)

    4. only the last R_RunID corresponding to each I_InstanceID (later are using MAX (R_RunID) GROUP BY I_InstanceID)

    5 R_HasAttachment value of last R_RunID

    6 R_RunTime last R_RunID value

    7. County of S_StepID against each R_RunID (may be 0 or a positive integer)

    8. County of S_HasAttachment against each R_RunID (may be 0 or a positive integer and may differ from the County of S_StepID)

    Friends, could one of you give it a try and help out me?

    Thanks in advance!

    PS: This had been driving me crazy for 3 days. I'm not able to get unique entries and entries for which references to the TestRun and TestStep tables are empty.

    Try the bottom of correlated subquery

    SELECT i_instanceid,

    i_hasattachments,

    (SELECT COUNT (R_RunID)

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid) cnt_runid;

    (SELECT MAX (R_RunID)

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid) cnt_latestrunid;

    (SELECT I_HasAttachments

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid

    AND tr.r_runid = (SELECT MAX (R_RunID)

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid)) R_HasAttachments;

    (SELECT R_RunTime

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid

    AND tr.r_runid = (SELECT MAX (R_RunID)

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid)) R_RunTime;

    (SELECT COUNT (S_StepID)

    OF TestSteps ts

    WHERE the ts. S_RunID = (SELECT MAX (R_RunID)

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid)) cnt_stepid;

    (SELECT COUNT (S_HasAttachments)

    OF TestSteps ts

    WHERE the ts. S_RunID = (SELECT MAX (R_RunID)

    OF TestRuns tr

    WHERE tr.r_instanceid = ti.i_instanceid)

    AND S_HasAttachments = 'Y') cnt_SHasAttachment

    OF ti TestInstances

    WHERE I_TestSetID IN (1190,1191,1192,1194,1195);

  • need help to write sql code

    Hi all

    I need to write a sql that retrieves data from the status table and check for this time in the ESHIFT table if the flag was or not. If is there, then it will keep the record as it is Furthermore, there

    did not understand at the time the flag was N suppose ESHIFT table has one record where you N 13:00:01-13:30 then the status register which is 13:00-13:59 min 59 s, we should get 13:00 - 13: records of 00:00 1 and 2 of 13:30:01-13:59 min 59 s

    create table ESHIFT (From_date date, date, to_date, flag varchar2 (2));

    insert into ESHIFT values (' 1 February 12 09:00 ", February 1, 12 13:20 ', 'Y');

    insert into ESHIFT values (' 1 February 12 13:20:01 ", 1 February 12 13:30 ',' don't);

    insert into ESHIFT values (' 1 February 12 13:30:01 ", February 1, 12 16:00 ', 'Y');

    SELECT * from eshift;

    create table status (date of From_date, to_date date, status number);

    insert into values of status (1 February 12 11:00 ', February 1, 12 12:00 ', 1);

    insert into values of status (1 February 12 12:00:01 ', February 1, 12 12:20 ', 2);

    insert into status values ("1 February 12 12:20:01", 1 February 12 12:59:59 ', 1);

    insert into status values ("1 February 12 13:00", February 1, 12 13:59:59 ', 1);

    insert into status values ("1 February 12 14:00", February 1, 12 14:59:59 ', 2);

    SELECT * STATUS;

    In the case above should get sql

    1 FEBRUARY 12 11:00 1ST FEBRUARY 12 12:00 1

    FEBRUARY 1ST, 12 12:00 1ST FEBRUARY 12 12:20 2

    FEBRUARY 1ST, 12 12:20:01, 1 FEBRUARY 12 12:59:59 1

    FEBRUARY 1ST, 12 13:00 1ST FEBRUARY 12 13:20 1

    FEBRUARY 1ST, 12 13:30 1 FEBRUARY 12 13:59:59 1

    FEBRUARY 1ST, 12 14:00 1 FEBRUARY 12 14:59:59 2

    It will be really great if someone can help me how I can get the desired result.

    Thank you very much in advance.

    Please provide instructions creating table and data. It makes it so much easier to answer.

    I think you want:

    Select (s.from_date, e.from_date) greatest from_date, less (s.to_date, e.to_date) to_date, s.status

    s status e eshift join on s.from_date < e.to_date="" and="" s.to_date=""> e.from_date and e.flag = 'Y '.

    order by 1

  • I need help with RoboHelp 10 conditional compilation tag option

    I need assistance with the option of conditional compilation tag. I want to apply CBT to the contents of a field. I looked at the help topics and believes that I applied the function correctly. However, it does not work as you wish. In the 2nd sentence below, I want the text highlighted in blue to appear only to the printed output and printed in purple text to appear only to the .htm / output online. Help, please.

    There are common tasks for managing files and folders in the browser

    in the grid of BBS files viewer. For more information on these common tasks see help

    and support in the successful business. click on the links below.

    Hello

    With the help of marking is a two part process.

    First part

    You create and apply tags for the information you want to order.

    Second part

    You create a create an Expression that is used when you generate your output. The Expression of build usually reads something like: NO Tag1 (or whatever the name of your tag)

    Then when generate you and use the Expression to build, the information containing the tag is not included in the build.

    See you soon... Rick

Maybe you are looking for