Use Query Results in Subsequent Query

Is it possible to use a value returned in query number one in
query number two as the "where"? For example, Box Number is
returned in query number one, and I want to query again for
additional information based upon the box number.

Lucky Kitty wrote:
> Is it possible to use a value returned in query number
one in query number two
> as the "where"? For example, Box Number is returned in
query number one, and
> I want to query again for additional information based
upon the box number.
>
Yeah, it is just a variable and can be used as anyplace
another variable
can be used.
But when one is doing this kind of thing at least 8 out of 10
times, it
can be done with a single query with a proper join.

Similar Messages

  • How to use one query results in another query

    hi,
    in help.sap I have founded that using variable type replacement path I can use one query results in another query. It is wrote there that I have to choose query name results I want to get in variable definition but I do not know where.
    How I can do this?
    Result I want to get is:
    In one query I have material prices in another material quantities. I want to calculate inventory value (price * quantity). Moreover prices are on plant level, quantities on storage type level. Plant is atribute of storage type.
    Can I do this?
    Regards,
    Andrzej

    Hi Andrzej,
    please check out this thread: Set parameters values depending on other parameters
    I had a discussion about query results as input for another query in there.
    For creating a workbook, just click on the save button after you ran your query in the bex.
    Siggi
    Message was edited by: Siegfried Szameitat

  • Using previous results in a query

    Hi
    Please can someone assist.
    I have a bex query - 1 structure only in my columns
    I have my data in rows broken down by calendar year.
    What I need to be able to do is to use the result in calendar year 2008 and sum it in calendar year 2009.
      Calendar month
      Calendar Year
      Remaiining
      Date of Hire
      Quota number
      Carry Over
      Deduction
    MAY
    2009
    21.960
    2000/05/15
    21.960
    0.000
    21.960
    2010
    30.000
    2000/05/15
    30.000
    0.000
    30.000
    2011
    42.260
    2000/05/15
    42.260
    0.000
    42.260
    2012
    39.240
    2000/05/15
    33.240
    6.000
    27.240
    2013
    50.000
    2000/05/15
    25.000
    25.000
    0.000
    JUL
    2008
    39.780
    2000/05/15
    39.780
    0.000
    39.780
    DEC
    2007
    43.700
    2000/05/15
    43.700
    0.000
    43.700
    Result
    266.940
    2000/05/15
    235.940
    31.000
    204.940
    My last column needs to be Entitlement which should be the carry over of 2012 + carry over of 2013 = 31 - which should be my entitlement for 2013.
    Not sure if that makes any sense.
    Please see images attached.
    Is there a way to do this with no ABAP, as I am not able to write the customer exit.
    Thank you

    You may try with Cell definitions concept by introducing a "Calyear structure" in rows and define 2013 cell accordingly. Rest all cells other than in Entitle ment KF take the definitions of their respective CKFs/RKFs. Leave all cells blank other than 2013 in Entitlement KF.
    Remove Calyear infoobject which is there currently in rows pane and then create a structure in place of it. Every year, you will need to enhance the Calyear structure and make the cell definitions accordingly as per your business requirement.
    Please have a look at my blog to get a brief idea on what I am saying.
    How to achieve Slab Wise or Bucket Wise and Age Wise requirements in BEx
    Message was edited by: SumaN ChakravarthY K
    Message was edited by: SumaN ChakravarthY K

  • Can I use the result of a query in another query of the same cube?

    Hello everybody;
    I have the following case. In query "A", I have used in rows a structure, whit a last formula named “Total A”, in another query "B", I need to used the result of “Total A”.
    Can anybody help me?
    Thanks in advanced.
    Mariana Serrano

    Hi Mariana,
    You can change local structures into reusable structures in any existing query by selecting the structure and, choosing Save as... from the context menu and then entering a technical name and a description in the Save Structure as... dialog box.
    You can change reusable structures that you are using in a query into local structures by selecting the structure and choosing Remove Reference from the context menu.
    Also go through this link:
    http://help.sap.com/saphelp_sem40bw/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    Best Regards,
    DMK
    *Assign point if it helps...

  • Using the results of one Query in a workbook as a filter in another query

    Hello!
    I'd like to have one workbook which my users can execute and the result from one Query (e,g, Customer Account Number) will then be used as a filter in a second query (which would be from a different cube).
    Can this be done?
    Cheers.

    Hi,
    As far as I understand your requirement, you want to pass the result of one query to another query as a filter.
    Well you can do this, by Using Replacement Path Variable.
    For e.g. you want to pass Values of Custmomer Account Number to another query. In the second query, create one variable on Customer Account Number with type Replacment Path. Here it will ask you to enter the name of the query from which you would like to take the values of Customer Account Number.
    When you will run the second query , it will execute the first query from which you want to read the customer accoutn number in the back-end. And it willl display the output the second query as per the valeus of customer account number.
    This will help.
    - Jaimin

  • Combine query, result from another query on SAP BI query Universe?

    Hello all,
    We are using SAP BI queries as datasource for our universes. Is the combined query option disabled for webi reports written on such universes?
    result from another query - is this option active for such webi reports? I see both these options greyed out so wanted to check.
    One last thing what is really difference between subquery and results from another query? subquery - you can use filters from that one data provider only right? or can you use a different data provider/report in sub query?
    Thanks a lot for all the replies.

    Hi,
    in BO 3.1 Combined query and result from another query options are not available in webi report on OLAP Universes  (SAP BW Universe.)
    Thanks,
    Amit

  • How to read query results in a query

    Is there any way the query results can be read from a table. What is the name of the table which intermedia stores the result by default after a select statement.
    null

    You need to:
    1- create a text index on your table
    2- use the contains clause in the SQL statement (e.g. select * from <your_table> where contains() ...)

  • Need to use the results of one query as an input to another query

    Hi, I have one sql query in my XML file, that returns more than one values for a column.
    and i want to use this output one by one as an input to the second query to retrive the data from the second query.
    Could please someone tell me if its possible in XML Publisher?
    If possible, please share the syntax to do the same
    For eg:
    Query 1:
    Select data1, data2 from query1 ; -- output data1 and data2
    want to use data1 and data2 one by one in the below query
    Query 2:
    select * from abc where name_id= data1/data2;
    Thanks and Regards
    Madhu

    Make sure your cursor declarations are in your declare section, not between the begin and end statements.

  • Query result filter another query

    Hello Guru
    I want to create a query A (List of PM_ORDER) filter by status.
    and another query B based on the list of query A.
    Query A became "filter" of query B.
    How handle this ?
    Message was edited by:
            laurent plichta

    Hi Laurent,
    You can attempt this using replacememtn path variable for the char you need to filter by. This is called Result Set Query. See here for details:
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/78a03c1178ad2ce10000000a114084/content.htm
    Hope this helps...

  • Query Builder problem - query results from previous query

    Hi.
    I have a 100% repeatable problem in Oracle Query Builder (Version 6.0.7.1.0) where some rows from the results of a previous query appear in the results for the current query. The queries being run are saved in *.brw files. If I close down Query Builder completely between queries, there is no problem. If I run one query, export the results to a CSV file, close that query and then open a second query, when I run the second query there are rows in the results that shouldn't be there (they are remnants of the first query). Interestingly the total number of rows for the second query is correct, so the same number of rows are missing as shouldn't be there. Anyone come across this before? Problem is repeatable for different database users and on different computers.
    regards,
    Martin

    as i posted earlier .. queryBuilder as a stand alone product is neither supported nor available anymore. it is only available as part of the report data wizard.
    thanks,
    ph.

  • Query result: reducing the query's line returned

    I have the query output below:
    SELECT null NRO_NEW, 123 NRO_OLD, 384603 OID_OLD, null OID_NEW FROM DUAL UNION ALL
    SELECT null , 0143355014948714, 384611, null  FROM DUAL UNION ALL
    SELECT null , 0143356000159014, 385305, null FROM DUAL UNION ALL
    SELECT 0143356000159014, null, null, 385305  FROM DUAL UNION ALL
    SELECT 666 , null, null, 384603 FROM DUAL UNION ALL
    SELECT 0143355014948714, null, null, 384611  FROM DUAL;
    NRO_NEW         NRO_OLD         OID_OLD OID_NEW
                    123             384603      
                    143355014948714 384611     
                    143356000159014 385305      
    143356000159014                         385305
                666                         384603
    143355014948714                         384611But I need to reach the result below( to put in the same line the NRO_NEW and NRO_OLD belong of the same OID_OLD and OID_NEW ):
    NRO_NEW         NRO_OLD         OID_OLD OID_NEW
                666             123  384603  384603
    143355014948714 143355014948714  384611  384611
    143356000159014 143356000159014  385305  385305Can anyone help me?
    Edited by: user5914526 on Sep 15, 2011 1:30 PM

    maybe this will help.
    SQL> With t1 as
      2  (SELECT null NRO_NEW, 123 NRO_OLD, 384603 OID_OLD, null OID_NEW FROM DUAL UNION ALL
      3   SELECT null , 0143355014948714, 384611, null  FROM DUAL UNION ALL
      4   SELECT null , 0143356000159014, 385305, null FROM DUAL UNION ALL
      5   SELECT 0143356000159014, null, null, 385305  FROM DUAL UNION ALL
      6   SELECT 666 , null, null, 384603 FROM DUAL UNION ALL
      7   SELECT 0143355014948714, null, null, 384611  FROM DUAL),
      8    t2 as
      9  (SELECT null NRO_NEW, 123 NRO_OLD, 384603 OID_OLD, null OID_NEW FROM DUAL UNION ALL
    10   SELECT null , 0143355014948714, 384611, null  FROM DUAL UNION ALL
    11   SELECT null , 0143356000159014, 385305, null FROM DUAL UNION ALL
    12   SELECT 0143356000159014, null, null, 385305  FROM DUAL UNION ALL
    13   SELECT 666 , null, null, 384603 FROM DUAL UNION ALL
    14   SELECT 0143355014948714, null, null, 384611  FROM DUAL)
    15  select t2.nro_new,
    16         t1.nro_old,
    17         t1.oid_old,
    18         t2.oid_new
    19    from t1, t2
    20   where t1.oid_old = t2.oid_new
    21  order by t2.nro_new;
       NRO_NEW         NRO_OLD         OID_OLD    OID_NEW
                666             123     384603     384603
    143355014948714 143355014948714     384611     384611
    143356000159014 143356000159014     385305     385305
    SQL>

  • Use query results in transformation

    Hello experts,
    is it possible to use the results of a query to load data to a infocube?
    We have an infocube containing detailed data. On this cube a query is built with a lot of calculated key figures. Now we would like to load these calculated key figures to a more aggregated cube.
    Thanks in advance,
    Ralph
    points will be awarded

    I would look at the APD process that Edwin mentions.  Typically, the way it would work is you use your query as input, writing the results to a DSO, then datamart the results form there to the cube.
    APD could also be used to directly update a Mstr Data infoobject if that made more sense, then datamart that to he cube.
    I'm not familiar with the CRM / falt file approach mentioned.  Might be fine for what you want to do.  The APD process has more options to perform additional manipulation of the data and even joining it with other query results if you wanted, plus the results end up in a DSO that I think might provide more options for retaining and managing the query results.
    You can review the online help for APD, also SAP's Data Mining class BW380 (might have a new name for BI 7.0) covers this area.

  • Unicode String Issue while Using Results from Another Query

    Hi All,
    In a webi report i have 2 queries say Sales Out and Investment. I need to have only those chains which are in Investement in Sales Out.
    So in Sales Out query i am using the option Results from another Query. The Chain values are in Unicode format.
    Though in universe i have Set Parameter Unicode_String ='Yes', this does not get applied when using option Results from another Query.
    Is there any solution to resolve this problem.
    Thanks
    Madhura

    leonhardtk wrote:
    I need to take values from the column of one table that meets certain critera, and create inserts into another table that includes this data.
    For example...
    {code}
    select emp_last_name from emp where emp_first_name like 'B%';
    Duncan
    Fitzgerald
    Johnson
    Smith
    {code}
    I then want to insert these values into another table:
    {code}
    insert into My_table values (
    sequence.nextval,99,99,[last_name]);
    {code}
    In the example above, I need it to insert a new row into My_table for where the "last_name" is each of the names from the select statement above (Duncan, Fitzgerald,Johnson,Smith).
    Based on other similar forum questions it looks like I should be doing something like:
    {code}
    INSERT INTO MY_TABLE
    (SELECT sequence.nextval,
                    99,
                    99,
                   (select EMP_LAST_NAME
                    FROM EMP
                    WHERE EMP_FIRST_NAME LIKE 'B%')
    {code}
    But this (obviously) doesn't work!
    Appreciate any assistance on this!
    KSL.
    Hi,
    Created this test data
    create table plch_test (name varchar2(50));
    insert into plch_test values('AKSHAY');
    insert into plch_test values('RAHUL');
    insert into plch_test values('APARNA');
    output
    1    AKSHAY
    2    RAHUL
    3    APARNA
    created another destnation table(in your case "my table")
    create table plch_test_1 (id number,name varchar2(50));
    created another sequence to generate employee ids
    create sequence test_seq;
    Now populated the desination table
    insert into plch_test_1(select test_seq.nextval,name from plch_test);
    verify the destination table
    select * from plch_test_1
    1    AKSHAY
    2    RAHUL
    3    APARNA
    Hope this helps
    Regards,
    Achyut Kotekal

  • Access to the Row Number in a Query Result

    Hi everyone! I have this query:
    select s.cod_score, ROW_NUMBER() OVER (ORDER BY s.cod_score) AS num
    from score s
    where s.categoria.cod_categoria='001' and s.gara.cod_gara='25251';
    that returns:
    COD_SCORE | NUM
    00001     1
    00002     2
    00007     3
    00009     4
    00014     5
    Now i want to display only the row with NUM='1', but how can i do that? I try with this:
    select s.cod_score, ROW_NUMBER() OVER (ORDER BY s.cod_score) AS num
    from score s
    where s.categoria.cod_categoria='001' and s.gara.cod_gara='25251' and num=1;
    but it tells me "%s: invalid identifier". How can i do?
    Thanks in advance :)

    986747 wrote:
    Thanks everyone :) Now if i want to use the result of that query in an UPDATE how can i do? I try with this:
    update score set posizione = '(first,1)' where score.golfista.n_tessera=(
    select golf
    from (select s.golfista.n_tessera as golf, ROW_NUMBER() OVER (ORDER BY s.cod_score) AS num
    from score s
    where s.categoria.cod_categoria='001' and s.gara.cod_gara='25251')
    where num=1);
    But it tells me that "SCORE"."GOLFISTA"."N_TESSERA" is an invalid identifier. Why? It is the primary key of the table golfista which has a REF in score...Hi,
    what is the structure of table SCORE?
    SCORE.GOLFISTA identifies a column. But SCORE.GOLFISTA.N_TESSERA seems not to be a valid value.
    Please read SQL and PL/SQL FAQ
    Whenever you ask a question post sample data (CREATE TABLE and INSERT statements) for a small significant amount of data.
    Post the logic of your process and the expected output.
    Additionally when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Regards.
    Al
    Edited by: Alberto Faenza on Feb 13, 2013 4:33 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Query on results from another query

    Post Author: Duncan1980
    CA Forum: Crystal Reports
    Is it possible to query on the results from another query.  I have a query that produces a list of document numbers.  I want to use the output from that query as the filter criteria in a another query in the same Universe. 
    The output from the first query can be as much as 2000, so it would be very time consuming to cut and paste these into a filter.
    Both reports are built, but can not figure out how to link the first report output to the filtering criteria on the second report.  I
    I am using business objects XI release 2 web intelligence 11.5.3.417 enterprise.

    Hi Vivek,
    It was not directly solved but I applied alternate logic to over come the issue.
    Here's what I did to overcome:
    I used a sub query in place of the whole result from another query.
    For Ex:
    Dim1 inlist result from another query1
    I made it as
    Dim1 inlist (Dim0)
    where Conditions.
    Here Dim0 is the object which we use for Result from another query and Conditions will be the necessary filter conditions to arrive proper Dim0.  Make sure proper context is formed for the sub query.
    Even though it resolved my problem, It introduces an new issue. It causes increase in query run time when huge set of data is returned from sub query.
    Please let me know if i haven't explained clearly.
    Hi Aris_BO,
    Sorry for not responding earlier.  The logic would probably make more queries null & not null. Thats why I was not advised to use it.
    Thanks
    LN

Maybe you are looking for