Multiple Select in same Query

I'm building a report based on a single table in APEX. The report requires the following.
select user, project, count(start date ), project, count(end date) where date between 01-jan-07 01-feb-07
(simplified to show the idea)
basicaly a count of projects that started between two dates and the ones that ended between the same two dates relating to the user.
I have writen the selects to do both parts and they work BUT is it posible to glue them together in a single statement?
I tried to searching the forum on "multiple selects" but never realy got anything close.
Is it possible to do this type of select? If so does it have a special name (so I can try a search on that name)
Thanks
Bjorn

First of all, '11-MAY-06' and '19-MAY-06' are not dates, they are strings. This has some important disadvantages:
1) Oracle has to implicitly convert them to a date, when they are being compared to a date column
2) Your application will be NLS (National Language Support) dependent, so they might break when you change a setting
3) When compared to a varchar2 or other string column, the comparison will give incorrect results. For example: 12-MAY-06 will be between 06-JAN-06 and 18-JAN-06
Bottom line: convert those dates to real dates using the to_date function, or the date 'yyyy-mm-dd' variant.
Back to your question, apparently you don't want to count the number of occurences of CON_ACTUAL_START and CON_SIGN_OFF, but you only want to count them when this date is between the two boundary values. So use the following:
select mli_clo
     , count(case when con_actual_start between date '2006-05-11' and date '2006-05-19' then 1 end)
     , count(case when con_sign_off between date '2006-05-11' and date '2006-05-19' then 1 end)
...Regards,
Rob.

Similar Messages

  • How to create parameter with multiple selection in a query (SQ02) ?

    Hi Exports
    Do you know how to create parameter with multiple selection in a query (transaction SQ02)?
    thanks.

    Hi
    i know how to create user parameter at SQ02,
    the question is how to create multiple selection parameter?

  • Advanced Table Multiple Selection

    Hi,
    I have created a advanced table under query bean with multiple selection feature.After querying the advanced table bean When i select the row in the table and click on another button i have writtten a logic in process from request to select only those rows selected in table ,but the view attribute of select check box is retuning null is there any way to identify the rows selected

    Use this code in AMImpl. It will definitely work. I have tried. Don't forget to create a Transient Attribute of Type String [[here transient attr is Select]] in the VO.
    public void selectFlag()
    System.out.println("In the selectFlag");
    SombitTestVOImpl vo = (SombitTestVOImpl)findViewObject("SombitTestVO1");
    if (vo != null)
    Row[] arow = vo.getFilteredRows("Select", "Y");
    System.out.println("Row count is"+ arow);
    if(arow != null && arow.length > 0)
    for(int i=0; i<arow.length; i++)
    System.out.println("Value of i is"+ i);
    String Job = (String) arow [].getAttribute("Job"); // here you have to write arow followed by i in square bracket
    Date NotifyDate = (Date) arow [[i]].getAttribute("NotifyDate"); // here you have to write arow followed by i in square bracket
    System.out.println("Value of Job is "+ Job);
    System.out.println("Value of NotifyDate is "+ NotifyDate);
    Cheers
    Sombit :)

  • Multiple selection in Query Panel. Operator Does not equal generates error.

    Hi,
    I'm using Jdeveloper 11.1.1.4 and creating Oracle Fusion Web Application with ADF Business Components.
    I want to use multiple selection on LOV in ADF Query Panel with Table, but I get the following error
    when I use operator "Does not equal":
    Error: Unsupported model type.
    SelectMany does not support a model of type class java.lang.Integer.
    A simple example:
    Schema: HR
    Generate default Business Components for tables Departments and Employees.
    Model:
    Create List of Values for EmployeesView(DepartmentId)
    List Data Source: DepartmentsView1
    List Attribute: DepartmentId
    Display Attributes: DepartmentName (UI Hints)
    Create View Criteria EmployeesByDepartmentVC for EmployeesView
    Criteria Item:
    Attribute: DepartmentId
    Operator: Equals
    Operand: Literal
    Select "Support Multiple Value Selection" (UI Hints)
    ViewController:
    Create blank JSF Page: showEmployees.jspx
    Drag EmployeesByDepartmentVC from Data Controls to showEmployees.jspx
    Create Query=>ADF Query Panel with Table
    Run application.
    Press Advanced button.
    Select operator "Does not equal" and department names "Administration;Marketing"
    Press Search
    Error: Unsupported model type.
    SelectMany does not support a model of type class java.lang.Integer.
    Note: it works fine with operator "Equals"
    Best,
    Kees.

    Hi,
    I was reading:
    http://www.oracle.com/technetwork/developer-tools/jdev/jdev-11gr2-nf-404365.html#bugs_fixed_in_11.1.2.2.0
    Bugs Fixed in 11.1.2.2.0
    Bug.No. 13508184
    unsupported model type error thrown for multi select view criteria
    I have tested the use case described in this thread with JDeveloper 11.1.2.2.0 but I still get the same error.
    when I use operator "Does not equal":
    Error: Unsupported model type.
    SelectMany does not support a model of type class java.lang.Integer.
    Is there anybody who can tell me more about this bug fix?
    Thanks,
    Kees.

  • Question about creating multiple output  files from same query

    I have a query like this:
    select * from emp;
    ename empno deptno
    Scott 10001 10
    Tiger 10002 10
    Hanson 10003 20
    Jason 10004 30
    I need to create multiple output files in xml format for each dept
    example:
    emp_dept_10.xml
    emp_dept_20.xml
    emp_dept_30.xml
    each file will have the information for employees in different departmemts.
    The reason I need to do this is to avoid executing the same query 200 times for generating the same output for different departments. Please let me know if it is practically possible to do this.
    Any input is greatly appreciated.
    Thanks a lot!!

    You can write a shell script to generate the multiple spools files for the same output. Below script may helps you.
    #====================
    #!/bin/bash
    n=0
    while [ $n -le 20 ]
    do
    n=`expr $n + 1`
    sqlplus -s system/manager <<EOF
    spool emp_dept_$n.xml
    select count(1) from tab;
    spool off
    EOF
    done
    #====================

  • Question about creating multiple XML files from same query

    I have a query like this:
    select * from emp;
    ename empno deptno
    Scott 10001 10
    Tiger 10002 10
    Hanson 10003 20
    Jason 10004 30
    I need to create multiple output files in xml format for each dept
    example:
    emp_dept_10.xml
    emp_dept_20.xml
    emp_dept_30.xml
    each file will have the information for employees in different departmemts.
    We are using DBMS_XMLGEN package to generate XML.
    The reason I need to do this is to avoid executing the same query 200 times for generating the same output for different departments. Please let me know if it is practically possible to do this.
    Any input is greatly appreciated.
    Thanks a lot!!

    one solution i can think of is to use SQLX operator instead of dbms_xmlgen.
    here is a sample example.
    declare
      l_xmltype xmltype;
      l_deptno  emp.deptno%type;
    begin
      for i in (select * from emp order by deptno)
      loop
        select xmlconcat(
                    xmlelement("ename", i.ename)
                   ,xmlelement("sal", i.sal)
                   ,xmlelement("detpno", i.deptno))
          into l_xmltype from dual;
        dbms_output.put_line(l_xmltype.GetClobVal());
      end loop;
    end;
    /Now here you can open the query once, keep writing to the file till the deptno
    is same, when the deptno changes, close the file and open a new file with new
    deptno and start writing.
    Note : in this way you will have to add the xmlprolog manually to each of the file which should not be an issue. after opening the file add the prolog string manually.
    Hope this helps.

  • Multiple select queries used in Excel BI report ,fetching data from Sharepoint DB(SP2010_Prod_ProjectServer) causing blockage on DB ,when more than one workbook(same copy of Excel BI Report) refreshed using Refresh All option.

    I am using mutiple select queries to fetch data from Project Server 2010 DB(its sharepoint DB) and these queries fetch data in Excel BI report by establishing connection with DB using instance name and all. I have enhance all these select queries and data
    is being fetched in secs. but when more than one copy of same Excel BI report is refreshed using 'Refresh All' option, then these select queries cause blockage on DB.
    Please let me know mitigation for this blockage issue.
    Should I use begin transaction and commit transaction statements/ shared lock statements.
    please reply

    Hi,
    run same query at the same time?

  • Can I make the parameter supports multiple selection and editable at the same time?

    Hi, 
    I am building my report using SQL Server Report builder 3.0. All the parameters are added to the report
    by the builder. When the user access the report by browser, he can change the parameter value and click "view report" button to load the report from the database.
    For one of the parameter, I want to provide user the ability to select frequently used value as multiple
    selection, and meanwhile let them able to edit the value if the preloaded selection doesn't contain what he wants.
    Is it possible to archive this goal using report builder?
    Thanks!

    You cant have this functionality using standard report viewer. An approximate work around can be implemented as follows.
    Have two parameters one based on your current parameter values (dropdown) and another one without any available values set and default set to NULL (Set Allow Null value property and pass Null as default value). This parameter will appear as disabled textbox
    with NULL checkbox checked. 
    Now in your code behind which gives you first parameter's values Add one more value say <None Of Values> and set value as some default value (-1 if int or just a random string value).
    Now in the value for second parameter set a expression like below
    =IIF(Parameters!FirstParam.Value ="<Select None>","",Nothing)
    This will make sure second parameter gets activated when you select option <none> from first. Then you can type the value you want in it
    In query behind just make filter like below
    WHERE field = CASE WHEN @Param1 <> '<None>' THEN @Param1 ELSE @Param2 END
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Multiple Select List looping thru PL/SQL function body returning SQL query

    Hi,
    I have a Multiple Select List. I want to loop through the values from the Select List and process them in a PL/SQL function body returning a SQL query. Currently, my code only returns the SQL SELECT results of one item in the select list. How do I change my code to make it return the results of all of the items in the select list? (I tested it and it is definitely picking up all the values in the select list).
    <b>
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s   VARCHAR2(20);
    q varchar2(32767);
    BEGIN
    selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
    -- htp.p('COUNT: '||selected_items.count);
      FOR i in 1..selected_items.count LOOP
      s := TO_CHAR(selected_items(i));
    -- htp.p('First: '||s);
    -- htp.p('Second: '||:s);
    -- htp.p('Third: '||TO_CHAR(selected_items(i)));
      q:= 'SELECT  '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
      RETURN q;
      END LOOP;
    END;</b>
    Thank you,
    Laura

    Laura,
    First, I would be careful of introducing SQL Injection possibilities. Any time I see
    'Select ... ' || :P123_FOO || ' ... '
    I worry about sql injection. In your case you are converting :P50_SELECTED_INSTRUMENTS into selected_items and then selected_items into s. So when I see
    'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
    I think, "I could use sql Injection and hack this."
    So, I would do some validation on :P50_SELECTED_INSTRUMENTS or some other method to avoid this.
    I'm not certain I understand your query. Do you really intend to allow the user to select the beginning of a string and then find all rows that start with that string? Or, do you just want to let them find when it matches the string. This is one way if you want to do matching:
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s VARCHAR2(32767);
    q varchar2(32767);
    BEGIN
    -- Change the : separate string to be comma separated with quoted strings
    s := '''' || replace(:P50_SELECTED_INSTRUMENTS, ',', ''',''')|| '''' ;
    -- htp.p('COUNT: '||selected_items.count);
    q:= 'SELECT '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE TO_CHAR(orig_geo_loc_sys) in (' || s ||' ) '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
    RETURN q;
    END;
    If you want to do something more like you originally stated, try this:
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s VARCHAR2(20);
    q varchar2(32767);
    BEGIN
    selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
    -- htp.p('COUNT: '||selected_items.count);
    q:= 'SELECT '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE 1=1 ';
    FOR i in 1..selected_items.count LOOP
    s := TO_CHAR(selected_items(i));
    q := q || ' and TO_CHAR(orig_geo_loc_sys) LIKE '''|| s ||'%'' ' ;
    END LOOP;
    q := q || ||'%'' '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
    RETURN q;
    END;
    Hope this helps...
    Anton

  • Interactive Reporting - Multiple SELECT stmts in 1 query

    Is it possible to multiple/nested select statements in 1 query? Actually what I need to do is pull records for the last 12 months. The SQL that I'm basing my IR query from has multiple SELECT statements and uses the add_month function w/ a parameter ranging from 0 to -12.
    Thanks.
    Terri

    Here's some of the additional SELECTs. There are more after these that I didn't include since it would be fairly long.
    CREATE OR REPLACE VIEW DEFECT_INVENTORY
    (NEW_COUNT, CLOSE_COUNT, BEGINNING_COUNT, ENDING_COUNT, MONTHNAME,
    SEVERITY)
    AS
    select New_Count, Close_Count, Beginning_count, Ending_Count,r.Monthname, r.Severity from
    (select p.New_Count, q.Close_Count,p.sev Severity, p.Month_Name Monthname from
    (Select count(bg_bug_id) New_Count,a.Month_Name, a.sev
    from
    (select bg_bug_id,
    bg_severity sev,
    bg_user_10 app,
    bg_detection_date,
    bg_closing_date,
    to_date(bg_user_26, 'yyyy-mm-dd') as cancel_date,
    to_date(substr(bg_vts,1,10), 'yyyy-mm-dd') as vts,
    to_char(to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1, 'MON-YY') as Month_Name,
    bg_status,
    to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1 AS rpt_DATE_end,
    to_date((to_char(add_months(sysdate, -12), 'MM')||'/01/'||to_char(add_months(sysdate, -12), 'YYYY')), 'MM/DD/RRRR') AS rpt_DATE_beg
    from bug ) a
    where (a.bg_status not like '65-Cancelled'
    and a.bg_detection_date <= a.rpt_DATE_end
    and a.bg_detection_date >= a.rpt_DATE_beg
    and a.cancel_date is null)
    group by a.sev, a.Month_Name) p,
    (Select count(bg_bug_id) Close_Count,a.Month_Name, a.sev
    from
    (select bg_bug_id,
    bg_severity sev,
    bg_user_10 app,
    bg_detection_date,
    bg_closing_date,
    to_date(bg_user_26, 'yyyy-mm-dd') as cancel_date,
    to_date(substr(bg_vts,1,10), 'yyyy-mm-dd') as vts,
    bg_status,
    to_char(to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1, 'MON-YY') as Month_Name,
    to_date((to_char(add_months(sysdate, -12), 'MM')||'/01/'||to_char(add_months(sysdate, -12), 'YYYY')), 'MM/DD/RRRR') AS rpt_DATE_beg,
    to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1 AS rpt_DATE_end
    from bug ) a
    where (a.bg_status like 'Closed'
    and a.bg_closing_date <= a.rpt_DATE_end
    and a.bg_closing_date >= a.rpt_DATE_beg
    and a.bg_closing_date is not null)
    or
    (a.bg_status like 'Closed'
    and a.vts <= a.rpt_DATE_end
    and a.vts >= a.rpt_DATE_beg
    and a.bg_closing_date is null)
    or
    (a.bg_status not like 'Closed'
    and a.bg_closing_date <= a.rpt_DATE_end
    and a.bg_closing_date >= a.rpt_DATE_beg
    and a.bg_closing_date is not null)
    group by a.sev, a.Month_Name) q
    where p.sev = q.sev) r,

  • Setting current values in Multiple Select List in SQL Query based Report

    Hi,
    I have a report based on a sql query that contains a multiple select list. Unfortunately I cannot get the multiple select list to display the current values (p_value) correctly. I have created a page item, :p311_current_versions, that is set using a pre-header process and it returns a value with a colon delimited format e.g. '10.1.2.1.0:10.1.2.2.0'. Then this item is used in the sql query to set the current value (p_value) of the apex_item.select_list_from_query function. However when the table is displayed, instead of having two entries, 10.1.2.1.0 and 10.1.2.2.0 selected, it has an extra entry '10.1.2.1.0:10.1.2.2.0' selected.
    Here is my code:
    select distinct a.product, a.version from (
    select distinct
    apex_item.display_and_save(2,product)||apex_item.hidden(1,env_product_id) PRODUCT,
    APEX_ITEM.SELECT_LIST_FROM_QUERY(3,decode(product, 'HTTP Server' , :p311_current_versions, version), 'SELECT distinct version d, version r FROM ebs_tech_stack where
    product ='''||PRODUCT||'''',
    decode(PRODUCT, 'HTTP Server' ,'multiple="multiple" style="width:170px"','style="width:170px"'),
    'NO') as version
    from ebs_environment_tech_stack
    where environment_id = :p311_umgebung_id) a order by a.product
    If anyone can help me figure out how to set the current values correctly I'd be really grateful!!
    Thanks in advance,
    Jean

    Jean,
    I don't think this is possible using the apex_item package. The select_list_from_query function accepts only a single value for the second parameter.
    Scott

  • Pass Multiple Parameters to SQL query in Drop down or Select Boxes

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    Hello all- I am using CR XI and SQL server 2000.I have written a SQL statement and used that statement as a 'command' in the Database Expert, to pull data into a report.  There are two issues I have that I need some help/advice on.-. The report needs 4 parameters.  A, B, C, D.-. I can create Parameters in the Database Expert that will prompt me for the data when I refresh the report. However,-. I need to be able to select those parameters in drop down boxes based on data in the SQL database.  The problem is that the parameter cannot pull the data without the criteria - so a drop down box seems impossible.  OR is it?  That is part of my question.  The other part is - Even if it is possible, can Crystal do this somehow?  NOTE: The query is selecting the data rather than Crystal - so Creating a Parameter field IN the report is futile. -. The other half of this problem is that users would like the ability to select multiple values from Field A and from Field B.  

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    I ended up using a stored procedure.  This queries the proper data, and allows me to use Dynamic Parameters to make multiple selections on the data.  (I query out a large portion of the data in the stored procedure, then pair it down using Dynamic Parameters in Crystal.) Here is the new problem this has created:My Dynamic Parameters are not pulling all the values from the query.  Ex.  One field in the query is a "directory" listing.  It has 227 unique values in it.  (It has multiple values, it is not constrained.)  When I create a Dynamic Parameter off of this field, I only get 18 of the 227 as available selections in the drop down box.  However, I can type in any of the 227 values into the field manually, I pull the proper data.  So the data is there, its just not showing up in the drop down box.   Anyone have any ideas on this?

  • How to put variable selection and the query result the same screen

    Dear all,
       how can I put the variable selection and the query result in the same screen? Please advise. Thanks.
    Jin Ming

    Not sure if you are saying you want the prompts on the same page as the results... however in 7.0 with BEx Analyzer, you can insert a text object from the design toolbar and assign it to the variable.... this way, lets say you run query for period 6, then the text object will display "6" on the same area where the query results are.

  • Report query with multiple selects

    On some of my Report Queries (that have multiple selects) it sometimes changes the rowset when I edit the specific SQL.
    For example, I have 2 selects in my Report Query andnd when I download the XML my first select’s data goes into <ROWSET1> and my second select’s data goes into <ROWSET2>. I then make my template and everything is good.
    But, sometimes when I edit the SQL in the report it changes the ROWSET number of the data so now my first select’s data in ROWSET2. This blows up the report. Is this a bug? Why is it switching the rowsets back and forth?

    I'm referring to the Report queries under shared components.
    My first query is like this:
    select A.emp_id
    from tab1 AC4, tab2 AC3, tab3 AC2, tab4 AC1, tab5 A
    where A.year = :page_year
    and C.FK_SCHOOL IN (SELECT c001
    FROM apex_collections AC1
    WHERE AC1.collection_name = 'SIS_REPORTS_SCHOOLS')
    and nvl(C.ACTIVE,'NONE') IN (SELECT decode(c001,'NONE',nvl(C.ACTIVE,'NONE'),C001)
    FROM apex_collections AC2
    WHERE AC2.collection_name = 'SIS_REPORTS_ACTIVES')
    and nvl(C5.CALENDAR_NO,'NONE') IN (SELECT decode(c001,'NONE',nvl(C5.CALENDAR_NO,'NONE'),C001)
    FROM apex_collections AC3
    WHERE AC3.collection_name = 'SIS_REPORTS_SCHOOL_CALENDAR_NOS')
    and nvl(C10.CLUSTER_CODE,'NONE') IN (SELECT decode(c001,'NONE',nvl(C10.CLUSTER_CODE,'NONE'),C001)
    FROM apex_collections AC4
    WHERE AC4.collection_name = 'SIS_REPORTS_CLUSTER_CODES')
    My second query needs to select the detail info from other tables, but I only want to do it for the (master) records that were returned in the first query.

  • Select the same attribute in a query more than once

    Hi Experts,
    My requirement is to select the same attribute in a query more than once.
    How can I acheive this?
    Expecting an early solution..
    Pilliga

    Hi,
    Create a calculated attribute that just displays the "same attribute".
    (Note: you will need to uniquely name this object).
    For example, if you wish to display Emp Name twice in the same query, then create a calculated attribute called Emp Name2 and select it and Emp Name in your query and the same info will be displayed twice in your results set.
    Cheers,
    Tanish

Maybe you are looking for