Using 2 queries

table 1
TYPEID     PRODUCTNAME     ORDERDATE
1234     mouse     2005/12/1
1234     keyboard     2005/12/1
1234     monitor     2005/12/1
1234     switch     2005/12/1
1234     cdrom     2005/12/2
1234     mouse pad 2005/12/2
1234     flash disk     2005/12/2
1234     cd rewrite     2005/12/2
2222     power cord     2005/12/1
2222     mouse     2005/12/1
3333     monitor     2005/12/1
3333     dvd writer     2005/12/2
first i would like to list all the items = '2005/12/1'
then within that results all the count(typeid) >=3
the final results should be
TYPEID     PRODUCTNAME     ORDERDATE
1234     mouse     2005/12/1
1234     keyboard     2005/12/1
1234     monitor     2005/12/1
1234     switch     2005/12/1
i tried
select * from table4 where typeid in (select typeid from table4 group by typeid
having count(typeid) >=3) and trunc(orderdate) = to_date('2005/12/1')
but not working, any ideas ?
thanks.

Tandra,
we don't need to add rownum if he wants to get all the result set. but in the user461730 query it was mentioned
first i would like to list all the items = '2005/12/1'
then within that results all the count(typeid) >=3i too thought he would need complete result set but again when i saw
the final results should be
TYPEID PRODUCTNAME ORDERDATE
1234 mouse 2005/12/1
1234 keyboard 2005/12/1
1234 monitor 2005/12/1
1234 switch 2005/12/1i thought he just need first 4 rows of the result set. so added rownum. Actually question is a bit confusing.
--Chaitanya.S.S.K                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Can we use multiple queries on one template

    Can we use multiple queries on one template

    Hi,
    if you're using data templates for your data set, you
    can put multiple queries in the XML data template.
    The queries may then be linked (or not) by the "link
    name" tag ...
    Grtz.Following you answer here...do you know eventually how/if possible to preview a report (with XMLP Desktop) that is using data templates for the data set?
    Thanks,
    Liviu

  • Problem occured when create a tree table for master-detail view objects using SQL queries?

    I am programming a tree table for master-detail view objects using SQL queries and these 2 view objects are not simple singel tables queries, and 2 complex SQL are prepared for master and view objects. see below:
    1. Master View object (key attribute is SourceBlock and some varaible bindings are used for this view object.)
    SELECT  cntr_list.SOURCE_BLOCK,                   
            sum(                   
             case when cntr_list.cntr_size_q = '20'                   
                  then cntr_list.cntr_qty                   
                  else 0 end ) as cntr20 ,                   
            sum(                   
             case when cntr_list.cntr_size_q = '40'                   
                  then cntr_list.cntr_qty                   
                  else 0 end ) as cntr40 ,                   
             sum(                   
             case when cntr_list.cntr_size_q = '45'                   
                  then cntr_list.cntr_qty                   
                  else 0 end ) as cntr45                    
    FROM (       
        SELECT yb1.BLOCK_M as SOURCE_BLOCK,       
               scn.CNTR_SIZE_Q,        
               count(scn.CNTR_SIZE_Q) AS cntr_qty        
        FROM  SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2       
        WHERE       
        scm.cmr_n = scn.cmr_n             
        AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')                 
        OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))                 
        AND scm.shift_mode_c = :ShiftModeCode                           
        AND scm.end_terminal_c = :TerminalCode      
        AND scm.start_terminal_c = yb1.terminal_c                  
        AND scm.start_block_n = yb1.block_n                  
        AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n                  
        AND scm.end_terminal_c = yb2.terminal_c                  
        AND scm.end_block_n = yb2.block_n                  
        AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n           
        AND scn.status_c not in (1, 11)             
        AND scn.shift_type_c = 'V'             
        AND scn.source_c = 'S'       
        GROUP BY yb1.BLOCK_M, scn.CNTR_SIZE_Q       
    ) cntr_list       
    GROUP BY cntr_list.SOURCE_BLOCK
    2. Detail View object (key attributes are SourceBlock and EndBlock and same varaible bindings are used for this view object.)
    SELECT  cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK,                
            sum(                     
             case when cntr_list.cntr_size_q = '20'                     
                  then cntr_list.cntr_qty                     
                  else 0 end ) as cntr20 ,                     
            sum(                     
             case when cntr_list.cntr_size_q = '40'                     
                  then cntr_list.cntr_qty                     
                  else 0 end ) as cntr40 ,                     
             sum(                     
             case when cntr_list.cntr_size_q = '45'                     
                  then cntr_list.cntr_qty                     
                  else 0 end ) as cntr45                      
    FROM (         
        SELECT yb1.BLOCK_M as SOURCE_BLOCK,     
               yb2.BLOCK_M as END_BLOCK,  
               scn.CNTR_SIZE_Q,          
               count(scn.CNTR_SIZE_Q) AS cntr_qty          
        FROM  SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2         
        WHERE         
        scm.cmr_n = scn.cmr_n               
        AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')                   
        OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))                   
        AND scm.shift_mode_c = :ShiftModeCode                             
        AND scm.end_terminal_c = :TerminalCode        
        AND scm.start_terminal_c = yb1.terminal_c                    
        AND scm.start_block_n = yb1.block_n                    
        AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n                    
        AND scm.end_terminal_c = yb2.terminal_c                    
        AND scm.end_block_n = yb2.block_n                    
        AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n             
        AND scn.status_c not in (1, 11)               
        AND scn.shift_type_c = 'V'               
        AND scn.source_c = 'S'         
        GROUP BY yb1.BLOCK_M, yb2.BLOCK_M, scn.CNTR_SIZE_Q         
    ) cntr_list         
    GROUP BY cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK
    3. I create a view link to create master-detail relationship for these 2 view objects.
    masterview.SourceBlock (1)->detailview.SourceBlock (*).
    4. I create a tree table using these 2 view objects with master-detail relationship.
    When I set default value for variable bindings of these 2 view objects and the matching records exist, tree table can work well. I can expand the master row to display detail row in UI.
    But I need to pass in dymamic parameter value for variable bindings of these 2 view objects, tree table cannnot work again. when I expand the master row and no detail row are displayed in UI.
    I am sure that I pass in correct parameter value for master/detail view objects and matching records exist.
    Managed Bean:
            DCIteratorBinding dc = (DCIteratorBinding)evaluteEL("#{bindings.MasterView1Iterator}");
            ViewObject vo = dc.getViewObject();
            System.out.println("Before MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
            System.out.println("Before MasterView1Iterator ShiftModeCode="+ vo.ensureVariableManager().getVariableValue("ShiftModeCode"));
            vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
            vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
            vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
            vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
            vo.executeQuery();
            System.out.println("MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
            DCIteratorBinding dc1 = (DCIteratorBinding)evaluteEL("#{bindings.DetailView1Iterator}");
            ViewObject vo1 = dc1.getViewObject();
            System.out.println("Before DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
            System.out.println("Before DetailView1Iterator ShiftModeCode="+ vo1.ensureVariableManager().getVariableValue("ShiftModeCode"));
            vo1.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
            vo1.ensureVariableManager().setVariableValue("DateTo", dateTo);
            vo1.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
            vo1.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
            vo1.executeQuery();
            System.out.println("after DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
    5.  What's wrong in my implementation?  I don't have no problem to implement such a tree table if using simple master-detail tables view object, but now I have to use such 2 view objects using complex SQL for my requirement and variable bindings are necessary for detail view object although I also think a bit strange by myself.

    Hi Frank,
    Thank you and it can work.
    public void setLowHighSalaryRangeForDetailEmployeesAccessorViewObject(Number lowSalary,
                                                                              Number highSalary) {
            Row r = getCurrentRow();
            if (r != null) {
                RowSet rs = (RowSet)r.getAttribute("EmpView");
                if (rs != null) {
                    ViewObject accessorVO = rs.getViewObject();
                    accessorVO.setNamedWhereClauseParam("LowSalary", lowSalary);
                    accessorVO.setNamedWhereClauseParam("HighSalary", highSalary);
                executeQuery();
    but I have a quesiton in this way. in code snippet, it is first getting current row of current master VO to determine if update variables value of detail VO. in my case, current row is possibly null after executeQuery() of master VO and  I have to change current row manually like below.
    any idea?
                DCIteratorBinding dc = (DCIteratorBinding)ADFUtil.evaluateEL("#{bindings.SSForecastSourceBlockView1Iterator}");
                ViewObject vo = dc.getViewObject();           
                vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
                vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
                vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
                vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
                vo.executeQuery();
                vo.setCurrentRowAtRangeIndex(0);
                ((SSForecastSourceBlockViewImpl)vo).synchornizeAccessorVOVariableValues();

  • I am using media queries and div will not centre on desktop version

    Hi,
    I am building a site for the first time using media queries. My problem is that I cannot get the header div (#layoutDiv1) to centre on the desktop version.
    I have pasted my code below, am I missing something?
    Any help would be great.
    Thanks, Alex.
    /* Mobile Layout: 480px and below. */
    .gridContainer {
      margin-left: auto;
      margin-right: auto;
      width: 100%;
      color: #FFF;
      background-color: #000;
    #LayoutDiv1 {
      clear: both;
      float: left;
      margin-left: 0;
      width: 90%;
      display: block;
      padding-top: 20px;
      padding-left: 20px;
      padding-right: 20px;
      padding-bottom: 20px;
    /* Tablet Layout: 481px to 768px. Inherits styles from: Mobile Layout. */
    @media only screen and (min-width: 481px) {
    .gridContainer {
      width: 100%;
    #LayoutDiv1 {
      clear: both;
      float: left;
      margin-left: 0;
      width: 90%;
      display: block;
      padding-top: 20px;
      padding-left: 20px;
      padding-right: 20px;
      padding-bottom: 20px;
    /* Desktop Layout: 769px to a max of 1232px.  Inherits styles from: Mobile Layout and Tablet Layout. */
    @media only screen and (min-width: 769px) {
    .gridContainer {
      width: 100%;
      text-align: left;
    #LayoutDiv1 {
      width: 1000px;
      padding: 20px;
      margin-right: auto;
      margin-left: auto;

    Because you don't have max-width to constrain the responsive design attributes from the tablet and phone are also then applied to the desktop because they are true.  Have you tried either setting a max-width or setting the clear and float to none in the desktop CSS?

  • There are a sample for loop data out using xpath-querie?

    hello,
    i have a web service that contains multiple rows. i transfered these data in a variable tInput. Now i want to transfer these data in a output variable.
    Is There a sample or tutorial, that shows how to loop data out of a variable (array) in a
    second variable using xpath-querie?
    regards,
    rala

    Hi,
    thanks for the Link, but it doesn't work at all.
    I have a variable tOutput with follow content:
    tOutput>
    <part name="parameters" >
    <SchedulForwardResponse>
    <SchedulForwardResult>
    <ArrayType>
    <plnnr>50001203</plnnr>
    <vornr>1</vornr>
    <starttime>20.08.2006 09:00:00</starttime>
    </ArrayType>
    <ArrayType>
    <plnnr>50001203</plnnr>
    <vornr>2</vornr>
    <starttime>20.08.2006 09:10:00</starttime>
    </ArrayType>
    <ArrayType>
    <plnnr>50001203</plnnr>
    <vornr>3</vornr>
    <starttime>20.08.2006 09:35:00</starttime>
    </ArrayType>
    </SchedulForwardResult>
    </SchedulForwardResponse>
    </part>
    </tOutput>
    I want to copy these content in the output Variable of my BPEL Prozess. But just the first <ArrayType> is copy to output:
    <ArrayTpe>
    <plnnr>50001203</plnnr>
    <vornr>1</vornr>
    <starttime>20.08.2006 09:00:00</starttime>
    </ArrayType>
    The other two <ArrayType> fail.
    I create 3 variables:
    <variable name="bufferOutput" messageType="ns0:SchedulForwardSoapOut"/> (MessageType of the invokeing WS)
              <variable name="count" type="xsd:integer"/>
              <variable name="n" type="xsd:integer"/>
    Count and n are counter for the while loop. Count is initial 1. For n i have follow expression:
    <assign name="prepareLoop">
    <copy>
    <from expression="ora:countNodes('bufferOutput','parameters','/ns0:SchedulForwardResponse/ns0:SchedulForwardResult/ns0:ArraySchedulType[1]')"></from>
    <to variable="n"/>
    </copy>
    </assign>
    In the BPEL Console i saw, that the value of n is1 and not 3 as i thought. When i set ora.countNodes to SchedulForwardResult n is null in the console.
    Does anybody try befor to copy such a content of a variable into another variable or has a idea how i can implement these?
    regards,
    rala

  • Cross tab data is getting multiplied if i use multiple queris in asingle report

    HI,
      i am using multiple queris for displaying data and graphs(charts).
      my requirement is to display 2 charts and data in crosstab in a single report.
      all the three thing (2charts and crosstab) will use diffrent values.
    I am writing 3 sql queries for getting appropriate values for charts and crosstab.
      Now the problem, both charts and crosstab are taking the values of all 3 queris
    i.e if i added crosstab  first to the report values are coming correctly. After  that if i add graph cross tab values are getting changed and graph values are not getting properly.
    if i add graph first then its coming correctly.
    if i tried to add all 3 components then values are going cores...... ?

    When you say you are writing 3 sql queries what do you mean? Are you creating 3 SQL command objects in the database expert? If so this is your problem, Crystal will pull a cartesian product through (this is every possible combinatin of rows from the 3 queries).
    If your 2 graphs and 1 crosstab are based on different datasets the way to approach this is to create each on a seperate report, then create a new blank report and add each of your 3 reports as subreports in the report footer.
    Hope this helps,
    Toby

  • Webi- Issues when using multiple Queries

    Hi All,
    I have a requirement as follows:
    A crosstab which will have Year dimension both in the vertical and horizontal header. How ever the horizontal header should have years chosen by the user.
    And the vertical header should have all the years that belong to that dimension.
                                   2013 2014 2015
    Audit1  2011                N     N      N
    Audit2  2013                Y     N      N
    Audit3  2014                N     Y      N
    For this I am using two queries.
    Query 1 ->Audit Name , Year
    Query 2 ->Year with a multiselect prompt
    But the problem with this is that after exec uting the queries the Year dimension gets merged and gives me a union of all the years.
    Also if I avoid merging the dimensions, it gives up the infamous #DATASYNC error.
    However I want crosstab horizontal header to show up only the selectd years(that are selected using the prompt by the user).
    Please help.

    Hi Pradnya,
    Your approach is really nice towards the requirement.
    I similarly created two queries containing Year and on
    one of the query created a prompt on Year and one query does not have any
    prompt.
    Lets say I have created two queries named [Query 1] and [Query
    2] and my merged dimension Year contains dimensions [Query 1].[Year] and [Query
    2].[Year].
    (Note: Query 2 has a prompt on Year)
    Created a detail variable named [test] which has the
    definition as =[Query 1].[Year] and Associated to the merged dimension [Year].
    Inserted a cross table and used [test] in the vertical
    header and in the horizontal header used the following formula:-
    =UserResponse([Query 2)].[Year];"Enter values for
    Year:")
    Please try the above and let me know how it goes.
    Regards,
    Manpreet

  • InfoObjects used in Queries

    In BW 3.0B, is there an easy way to determine which InfoObjects are used in queries?  The ‘Where Used’ list for individual objects does not include queries.  I’m really looking for a way of determining which objects are actually used for reporting.
    Thanks in advance,
    Mike

    Hi Mike,
    You can see all queries in table RSRREPDIR , which will have some compressed name of the query in COMPUID field. This field will link it to a cross reference table which lists all the columns and rows of the report (table RSZELTXREF).
    The infoobject is stored in this table (RSZELTXREF) in a compressed format, I am not sure where to find the link to the infoobject technical name, but you can find the infoobject description in RSZELTDIR.
    This way (RSRREPDIR>RSZELTXREF>RSZELTDIR) you should get close to what you want.
    cheers,
    Ajay

  • Ability to use u0093Globalu0094 queries, and modify/save them u0093Locallyu0094

    Hi,
    I have one requirement of Creating Role with RRMX Tcode, to Ability to use “Global” queries, and modify/save them “Locally” for their own use.  Ability to Create & Modify “Local” queries for their own use.
    I have tried with all combination but still not able
    to save any query(global or local) as local queries by using the option "change query(Local view)",Where as if we do changes in the global queries default its getting saved under global only.
    We are unable to restrict only for Local changes.
    Let me know in the object name and what value need to add there.
    Regards,
    Deepak

    Hi Bhanu,
    I have tried to find the option for the local and Glabal, but did not got any thing. May be my functional consulatant can find out.
    Can you please let me know the exact object name and the value, i have mainatined  Object S_RS_COMP and S_RS_COMP1 and the value 01,02,03,16.
    Rgds,
    Deepak

  • Variable Sequence when using multiple queries

    Hi Experts,
    how can I adjust the variable sequence of a workbook that uses multiple queries (with variables of which each exists in at least two included queries)?
    E.g.:
    DP1 with variable sequence "A, B, D"
    DP_2 with variable sequence "A, C, D"
    DP_3 with variable sequence "B, C"
    I want "A, B, C, D" as the sequence for the workbook but i did not figure out how to adjust this.
    I already tried to insert a dummy DataProvider that holds all variables in the right sequence.. No success..
    Any help very appreciated!
    Marco

    Hi Mayank,
    thanks for your answer.
    I wonder how the displayed sequence of the common variables is derived from the underlying queries. Perhaps one can change the sequence of the variables by inserting the DataProviders in another sequence?!
    Regards,
    Marco

  • Finding hierarchy use in queries

    Hi BWExperts,
    We have Four Hiearchies on one Infoobject and the Infoobject is using several Queries.The requirement is, we would like to know which hiearchy is using in which query.Please advice is there any program or backend table exists for this.
    Thanks in advance.
    Regards,
    Preetham

    Hello,
    Have a look at this
    Identifying where a hierarchy is used
    Also
    https://wiki.sdn.sap.com/wiki/display/BI/ImportantTablesinSAPBI%28NW2004%29
    https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=35458&focusedCommentId=45993#comment-45993

  • Approval using User Queries

    Hello everyone.
    I need approval using User Queries on  Detail Sales Order  when User Field "U_DifSec" value change '02' (default value) to '01' at least one row.
    This is the Query, but don't  function on SAP if running on SQL Managment studio do function very good.
    Declare @conteodescuento int,
            @docentry int
    Set @docentry=(select DocEntry FROM ORDR Where DocNum = $[$8.1.0])
    Set @conteodescuento = (select count (*) from RDR1 Where docentry=@docentry and U_DifDesc='01' group by U_DifDesc, DocEntry)
    --Check row by row and sumary when U_DifDesc = '01'
    Select distinct 'true'
    from  ORDR where Docnum = $[$8.1.0] and @conteodescuento >=1
    -- trigger true when @conteodescuento >=1

    Hi Douglas Marroguin...
    Approval Procedure is not possible by the Row wise in the standard behaviour ...
    try this work around
    http://it.toolbox.com/blogs/sap-library/approval-procedures-line-level-and-header-level-part-1-9662
    Hope Helpful
    Regards
    Kennedy

  • How can we say if Join better than using Sub Queries ??

    Hi all,
    I am trying to understand the rationale behind "Is _Inner Join_ better than using _Sub Query_ ?" for this scenario ...
    I have these tables --
    Table1 { *t1_Col_1* (PrimaryKey), t1_Col_2, t1_Col_3, t1_Col_4 }
    -- Number of rows = ~4Million , t1_Col_3 has say 60% entries non-zero -----> (Condition 4)
    Table2 { *t2_Col_1* (PK), t2_Col_2, t2_Col_3 }
    -- Number of rows = ~150Million, t2_Col_2 maps to t1_Col_1 -----> (Condition 1). This means for every distinct value of t1_Col_1 (its PK) we'll have multiple rows in Table2.
    Table3 { *t3_Col_1* (PK), t3_Col_2, t3_Col_3 }
    -- Number of rows = ~50K, t3_Col_1 maps to t1_Col_2 -----> (Condition 2)
    Table4 { *t4_Col_1* (PK), t4_Col_2, t4_Col_3 }
    -- Number of rows = ~1K, t4_Col_2 maps to t3_Col_2 -----> (Condition 3)
    Now here are the 2 queries: -
    Query using direct join --
    SELECT t1_Col_1, t2_Col_1, t3_Col_1, t4_Col_2
    FROM Table1, Table2, Table3, Table4
    WHERE t1_Col_1=t2_Col_2 -- Condition 1
    AND t1_Col_2=t3_Col_1 -- Condition 2
    AND t3_Col_2=t4_Col_1 -- Condition 3
    AND t1_Col_3 != 0
    Query using SubQuery --
    SELECT t1_Col_1, t2_Col_1, t3_Col_1, t4_Col_2
    FROM Table2,
    (SELECT t1_Col_1, t3_Col_1, t4_Col_2
    FROM Table1,Table3, Table4
    WHERE
    AND t1_Col_2=t3_Col_1 -- Condition 2
    AND t3_Col_2=t4_Col_1 -- Condition 3
    AND t1_Col_3!= 0
    WHERE t1_Col_1=t2_Col_2 -- Condition 1
    Now the golden question is - How can I document with evidence that Type-1 is better than Type-2 or the other way ? I think the 3 things in comparison are: -
    - Number of rows accessed (Type-1 better ?)
    - Memory/Bytes used (Again Type-1 better ?)
    - Cost ( ?? )
    (PS - testing on both MySQL, Oracle10g)
    Thanks,
    A

    So, is it right to conclude that Optimizer uses the optimal path and then processes the query resulting in nearly the same query execution time ?If the optimizer transforms two queries so that they end up the same, then they will run in the same time. Of course, sometimes it cannot do so because of the the way the data is defined (nulls are often a factor; constraints can help it) or the way the query is written, and sometimes it misses a possible optimization due to inaccurate statistics or other information not available to it, or limitations of the optimizer itself.
    Is this the right place to ask for MySQL optimization ?Probably not.

  • Top n analysis using hierarchial queries

    hi all,
    can we do top n analysis in hierarchial queries using level pseudo columns. if so please give an example.
    thanks and regards,
    sri ram.

    Hi,
    Analytic functions (such as RANK) often interfere with CONNECT BY queries. Do one of them in a sub-query, and the other in a super-query, as shown below.
    If you do the CONNECT BY first, use ROWNUM (which is assigned after ORDER SIBLINGS BY is applied) to preserve the order of the CONNECT BY query.
    WITH     connect_by_results     AS
         SELECT     LPAD ( ' '
                   , 3 * (LEVEL - 1)
                   ) || ename          AS iname
         ,     sal
         ,     ROWNUM               AS r_num
         FROM     scott.emp
         START WITH     mgr     IS NULL
         CONNECT BY     mgr     = PRIOR empno
         ORDER SIBLINGS BY     ename
    SELECT       iname
    ,       sal
    ,       RANK () OVER (ORDER BY sal DESC)     AS sal_rank
    FROM       connect_by_results
    ORDER BY  r_num
    ;Output:
    INAME                  SAL   SAL_RANK
    KING                  5000          1
       BLAKE              2850          5
          ALLEN           1600          7
          JAMES            950         13
          MARTIN          1250         10
          TURNER          1500          8
          WARD            1250         10
       CLARK              2450          6
          MILLER          1300          9
       JONES              2975          4
          FORD            3000          2
             SMITH         800         14
          SCOTT           3000          2
             ADAMS        1100         12 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data. If you use only commonly available tables (such as those in the scott or hr schemas), then you don't have to post any sample data; just post the results.
    Explain how you get those results from that data.
    Always say what version of oracle you're using.

  • List of infoobject used in queries

    hello!
    can someone tell me how to find the list of the infoObjects (fields) that are being used in all queries based on some set of infoProviders?
    I would like to know what tables I should be looking for.
    What I'm trying to find is  the list of infoObjects used by all my users, from the genereal list of infoObjects found in the infoProviders they use.
    thank you very much,
    Roman

    Function Modules RSZ_I_BASIC_CHA_WHERE_USED and RSZ_DB_KEYFIG_WHERE_USED will be able to tell you which queries an InfoObject is used in. You can use the RSDIOBJ table to get a list of the InfoObjects that are active in your BW system.
    Create an ABAP program that does the following:
    1) SELECT all of the InfoObjects in RSDIOBJ into an ITAB where the RSDIOBJ-OBVERS = 'A' (Active) and RSDIOBJ-IOBJTP = 'CHA' or 'KYF' (Character and Key Figure respectively).
    2) Copy ITAB into another ITAB.
    3) Delete all records with InfoObject type of Key Figure in the first ITAB, so that you only have Characteristics in the ITAB.
    4) Delete all records with InfoObject type of Characteristics in the second ITAB, so that you only have Key Figures in that ITAB.
    5) LOOP through the Characteristics ITAB and call the RSZ_I_BASIC_CHA_WHERE_USED FM, for each row in the ITAB, with the Import Parameters of I_OBJNM being the InfoObject being processed, I_OBJVERS always equal to 'A' and I_QUERIES_ONLY always equal to 'X'. LOOP through the structure returned and populate to a third ITAB.
    6) After all Characteristics have been processed, LOOP through the Key Figures ITAB and call the RSZ_DB_KEYFIG_WHERE_USED FM, for each row in the ITAB, with the Import Parameters of I_OBJNM being the InfoObject being processed, I_OBJVERS always equal to 'A'. LOOP through the structure returned and populate to the third ITAB.
    Edited by: Dennis Scoville on Nov 3, 2009 3:34 PM

  • How to use multi queries inside the RTF file

    Hi all,
    I develope a data source in report developer 10g, and use it to create the RTF files... I have some files wich contains more than 1 query. how can I refer to the fileds in the other queries in side the RTF file, because it's bring the filed from the first query by default??
    ThanX in advance

    ThankX DD
    But that wont work for my case. the problem that I have actually is in RTF.
    for example:
    I have 3 qeuries. A,B & C. A: contains the employee data. B: his Earnings and C: his Deductions.
    in the RTF file it shows me only A contents. wich means it's not entring B & C loops, notice I add <?for-each:B_GROUP_NAME?> and same for C also.
    all my other reports wich have single qeury worked fine.
    Regards to all,
    Message was edited by:
    Adam Ali

Maybe you are looking for

  • Batch managment

    Can any one explain me the very clear picture between client level,plant level and material level with one suitable example. What will happen if i do the goods receipt for STO within the same company code how the batch will be generated depending on

  • Credit limit vs financial document

    SAP GURUS : I have taken the credit limit 20,000rs and financial doc value 10,000rs and created a sales order  for 11000rs.But 1000rs is not getting updated in Fin Doc or Credit Limit,plz let me know ASAP from where the system is taking this value?

  • Can't convert AIFF to MP3

    Can't convert songs in iTunes. I have iTunes 7.02. I've followed the process as detailed in iTunes help as well as in a "missing manuals" book. Here's what I've done to try to change a song from AIFF file to MP3: 1) In iTunes, chose iTunes > Preferen

  • My program keeps crashing at start-up

    Running Windows 7 Pro on a PC. Adobe Premiere keeps crashing on start-up.

  • Issues with Apogee's JAM not being recognized?

    Hi, I just purchased the JAM guitar input from Apogee and it works fine with my iPad 2 and my Macbook Pro (which is on OS X Lion already). However, when connecting it to my new 2011 Macbook Air 13" which was just released last week, it is not recogni