Query - Get data from the same table and field two times on a single line

I have prepared a query showing the bill of material. At each line each component will be a new line and I want to have the description of the material at the top (the master material composed of the component ones) and also the description of the component materials on the same line. This means that I should be able to use MAKT table 2 times on a single line of the query. I have used the query tool with SQ01 and SQ02 tcodes. How can I get the the description of the material at the top and also the description of the component material on a single line?
Thanks in advance for the answers.

Yasar,
Any time you wish to use a table twice in an SQ01 query, you have to create an alias.
SQ02 > select the infoset, 'change' > go to Join definitions.
Select 'Alias' button.  Create. Select your table name (such as MAKT) and define an alias, such as 'COMP_MAKT' for component descriptions.
Now you can insert the Alias table into your infoset just like it was a regular table, and use standard join method to join COMP_MAKT to your component material number.
Best regards,
DB49

Similar Messages

  • How to update a table (CUSTOMER) on a Report Server with the data from the same table (CUSTOMER) from another server Transaction server?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) From another server ex: Transaction server?
    Set up steps so inset, update or delete operation takes place across the servers.
    It would be great if someone please enlighten me in details about this process in MS SQL Server 2008 R2.
    Also please describe would it be different for SQL Server 2012?
    If so, then what are the steps?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) from another server ex: Transaction server?
    Set up steps so that inset, update or delete operation gets done correctly across servers.
    I was not sure about the answer, it would be great if someone please put some light on this and explain in details about this process in MS SQL Server 2008 R2.
    Also it would be very helpful if you please describe would it be different for SQL Server 2012? If so, then what are the steps?

  • Retrieve data from the same table

    i have a table with following fields
    emp_no,name,salary,department,dept_prev,prev_emp_no.
    now i want retrieve emp_no,name,salary,department, from the data base for a perticular employeee number along with dept_prev
    but dept_prev is the prev_emp_no dept_prev
    now iam doing two query like this
    first query to retreive name,salary,department
    select name,salary,department from employee where emp_no = 10
    second to retrieve the dept_prev from the same table but this
    dept_prev must be based on prev_emp_no
    select dept_prev from employee where emp_no in(select prev_emp_no from employee where emp_no =10)
    can any one suggest to combine these two queries in a single sql statements, because all the fieldds are from the same table.
    Thanks

    Would this one solve it?
    SELECT emp.NAME, emp.salary, emp.department,
           prev_emp.dept_prev
      FROM employee emp,
           employee prev_emp
    WHERE emp.emp_no      = 10
       AND prev_emp.emp_no = emp.prev_emp_no;
    not tested
    C.

  • How to read the hierarchy data from the same table using loop in AMDP method

    Hi All,
    We have a requirement to get the top partner from BUT050 table.
    Here the Top parent is nothing but the top most in the hierarchy of the partners from BUT050.
    Example:
    For partner 1234 (BUT050-PARTNER1) there is partner 3523(BUT050-PARTNER2) one level above
    For partner 3523(BUT050-PARTNER1)  there is partner 4544 (BUT050-PARTNER2) last level .
    so in this case for the partner 1234 the Top parent is 4544 .
    I have created AMDP Procedure method to get the top-parnet and below given is the logic implemented in AMDP method.
    Here i have implemented a recursive logic with the WHILE loop to get the top most hierarchy partner from the same table BUT050
    IV_Parent is the input partner and ev_top_parent is the output value.
    AMDP Procedure Method:
        DECLARE lv_date VARCHAR(8) := TO_VARCHAR (current_date, 'YYYYMMDD');
        DECLARE found INT := 1;
              iv_partner1 =  SELECT partner1 FROM but050
                              WHERE partner2 = iv_partner
                              AND reltyp = :iv_hierarchy
                              AND date_to >=  :lv_date
                              AND date_from <= :lv_date;
         WHILE found <> 0  do
           select partner1 into ev_top_parent from :iv_partner1;
                           iv_partner1 =  SELECT partner1 FROM but050
                           WHERE partner2 in ( select partner1 from :iv_partner1 where partner1 is not null)
                           AND reltyp = 'ZBP004'
                           AND date_to >= :lv_date
                           AND date_from <= :lv_date;
           select COUNT ( partner1 ) INTO found FROM :IV_PARTNER1;
        END WHILE;
    This method is working fine, but here it is only taking one single partner and getting the top parent as output.
    Now i would like to convert this mehtod so as to accept n number of partners (not one single partner) as input and should process each partner to get the top parent.
    Could anyone guide me how can i handle the given AMDP method further so as to work some how it is within another loop from other AMDP method.
    Thanks.
    Regards,
    Laxman.P

    Hi
    Go to SE11 and enter the hierarchy table name.
    /BIC/H....(infoobject name)...and execute the table and select table entry and delete all....
    Thanks
    TG

  • Want to select individual data as well as aggregate data from the same table

    want to select a, b  from tab1  also need to find in the same table  tab1 need to do sum(b) group by a

    SELECT a,b,0 AS Ord
    FROM tab1
    UNION ALL
    SELECT a,SUM(b),1
    FROM tab1
    GROUP BY a
    ORDER BY a,Ord
    assuming SQL Compact
    If its SQL Server then we have much simpler methods
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Getting Data from 2 different table and saving it in the third table

    Hi,
    My question is i have 2 different table where the data is stored. And Nothing is at Level0 and i don't need it.
    Table A will be at Level1, this is a scroll and depending on this value the level2 grid will be populated with the values.
    Say for example Table A is groups; data e.g., Cars, MotorBike etc
    Table B will have the data for Group Cars: Holden, Toyota, Honda etc., MotorBike: Honda, Suzuki, Yamaha etc.,
    Now lets say there are 3 divisions in the company AA , BB
    Division AA has been allocated group Cars only
    Division BB has been Allocated Both Cars and MotorBikes.
    To do this i have used a query view where depending on the Division i choose the group and then i get the required fileds.
    Now my Problem is that i need to save this data in table C but on the ad-hoc basis can't write a query with in the code to do that.
    tried using work record on the scroll but i cant do that as well. Any Suggestions?
    One more thing when the Page open this data should be pre-populated on the page depending on the division, the user will not be able to select anything from the prompt.
    Edited by: 952330 on Aug 12, 2012 8:32 PM

    I hope I can clarify:
    For our purposes here:
    Table 1 = "Step 2 - Product Sizes"
    Table 2 = "Option id Master"
    Table 3 = "Export - Product Info"
    Table 1:
    The user would enter values for "productcode," "Horz," and "Vert"
    "Size" would auto fill based on values in Horiz and Vert (I have this taken care of already).
    Table 2: This is a completely static table that I want to search against. - Data from other tables in the doc does not alter or change the data in this doc.
    We just want to look at table 2. Find the existing value in "table 2 : size" column that matches the "table 1 : size" column  and then pull the "optionids" and "productprice" from that row.
    Can the value from "Table 1 : Size" be used as a search term in "Table 2 : Size?"
    Table 3: The user does not enter any values on this table. 
    "productcode" is pulled from table 1 - "Table 1 :: A5" = "Table 3 :: A5"
    "optionids" and "productprice" are pulled from Table 2 columns "D" and "E" - however we do not know which Table 2 row it is pulling from until we enter data in Table 1.
    As I'm writing this I'm realizing that
    A. this is probably really confusing to you.
    B. this may be impossible inside of numbers.
    If you have some other method that would facilitate the same out come but be structured differently please let me know.
    --- maybe to help you understand further what I am doing here is my current workflow:
    I record the size of a piece of art.
    Then I manually go to my "Option id Master" and find the same size.
    I then copy the corresponding "optionids" and "productprice" cells. (these options control the prices displayed on my website)
    I got to my "Export - Product Info" table and paste the values in the corresponding cells.
    I was hoping to automate this as it takes a long time when you have hundreds of products.
    Thanks for the help!

  • Update multiple rows with datas from the same table

    i have a table like
    name version value1 value2
    2 A 4,31 3,5
    3 A 3,45 10
    2 B 6,97 12
    4 B 12 16
    so name + version is unique
    i have to update the datas value1 and value2 ( version A) with the datas from version B where the name ( VersionA) = name version B
    i.e the result should be
    name version value1 value2
    2 A 6,97 12
    3 A 3,45 10
    2 B 6,97 12
    4 B 12 16
    is it possible to do this in sql? ( sql. 8.1)

    ... if your table does not contain exactly what you expect you could get:
    'single row sub-query returns more than one row'
    To prevent that, put a unique index on (name, version). If this combination is not always unique, you will need to cater for the possibility in the update statement.

  • Multiple language data in the same table and indexes

    We have 8.1.5 database with
    NLS_LANGUAGE=ENGLISH and NLS_TERRITORY=UNITED KINGDOM set at the database level. We also set the NLS_LANG appropriately when we index the data. We also use the preference setting BASE_LETTER=YES when indexing.
    Our tables contain book titles which is what we index using interMedia. Being an online book store, this table may contain titles in English (most of the titles are in English being UK) and some titles in French. Please note the French language has accents and diacritics. Normally in a French database with NLS parameters set correctly and BASE_LETTER=YES, if we search for a title with accent / diacritic it will return the record correctly and match the rows with or without the accents (e.g. searching for video will return both vidio (not the accent on e) and video). However, with the UK settings the accents are not ignored during indexing and it only returns the records that exactly match the search word (e.g. searching for video returns only video and searching for vidio returns only vidio (note the accents on e in the last two videos)).
    Question: Is there any way to appropriately index multiple language specific titles in the same database? If yes, how? Is it possible at all? Suggestions, ideas are welcome.
    null

    Similar request; if there are several different languages used in a database, but a search word can be typed in by anyone and not necessarily in the default language, I still want to be able to pick up all the records (including text in blobs) in any language where my search word = the equivelant word in the other languages; eg. searching on "tree", the search would bring back a document that contained "l'arbre". I then want to set the default language, and allow the user to select a "search in these languages" option to expand the search from the default "tree" to all languages in the database.
    I know about the multi_Lexer but does it extend functionality to this level?

  • How to get data  from an internal table in some other program

    I would like to get data from the internal table in the other program. When I using FM "LIST_FROM_MEMORY" to get the data, it doesn't work and the exception is not fount.
    If any special code need in the other program, like write data to memory .
    Many thx .
    From Ross Wang

    Hi
    <li>You need to have interaction if you want to use EXPORT/IMPORT statments.
    <li>The internal tables in both programs must be same
    <li>Program one ..Calling program
    REPORT ZTEST_NOTEPAD.
    DATA: BEGIN OF it_t001 OCCURS 0,
            bukrs TYPE t001-bukrs,
            butxt TYPE t001-butxt,
          END OF it_t001.
    START-OF-SELECTION.
      SUBMIT ztest_notepad1 AND RETURN.
      IMPORT it_t001 FROM MEMORY ID 'ZTEST_T100'.
      LOOP AT it_t001.
        WRITE:/ it_t001.
      ENDLOOP.
    <li>Program two ...Called program
    REPORT ztest_notepad1.
    DATA: BEGIN OF it_t001 OCCURS 0,
            bukrs TYPE t001-bukrs,
            butxt TYPE t001-butxt,
          END OF it_t001.
    START-OF-SELECTION.
      SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_t001 UP TO 10 ROWS.
      IF sy-dbcnt > 1.
        EXPORT it_t001 TO MEMORY ID 'ZTEST_T100'.
      ENDIF.
    I hope that it gets you some idea.
    Thanks
    Venkat.O

  • Comparing totals from the same table

    I am trying to compare data from the same table..
    i am using an alias of the table to set up the select but i am running into a cartesian set.
    I am comparing data (totals) from different dates from the same table ; i have included the query which is giving me a problem:
    select a.date_in,b.date_in,a.Table_name,
    DECODE(a.schema_name,
    'EZLIVE','ITP','EZAC','ACT','OTHER')AS DEPT,
    a.type,
    a.status,
    a.TOTAL,
    b.total
    from agg_results a,agg_results b
    where a.schema_name=b.schema_name
    and to_char(a.date_in,'mm/dd/yyyy')='&date_in'
    and to_char(b.date_in,'mm/dd/yyyy')='&date_in';
    any help thanks
    Ellery

    I think you need to join in-line views instead of the tables directly. something like:
    SELECT a.date_in,b.date_in,a.table_name,a.dept,a.type,a.status,a.total,b.total
    FROM (SELECT date_in,table_name,
                 DECODE(schema_name,'EZLIVE','ITP',
                                    'EZAC','ACT','OTHER') dept,
                 type,status,total
          FROM agg_results
          WHERE date_in = to_date('&date_in','mm/dd/yyyy') a,
         (SELECT date_in,table_name,
                 DECODE(schema_name,'EZLIVE','ITP',
                                    'EZAC','ACT','OTHER') dept,
                 type,status,total
          FROM agg_results
          WHERE date_in = to_date('&date_in','mm/dd/yyyy') b
    WHERE a.dept = b.deptTTFN
    John

  • Getting the system date from the dual table

    Hi, im just wondering if anyone can help me. I need to get the current date to enter into a message table saying that an email has been sent and im struggling to find a way to get the date. Should i try to get this date from the dual table, if so how can i get this oracle date type out of the resultset? or is there some easy way in java to do this without accessing the database??
    Thanks for any help
    Sean

    Date now = new Date();
    is the easy Java way to get the current date and time.

  • Ways to get data from the internet with XCode and Objective-C

    Hey guys,
    Thanks in advance for any help. I was simple wondering what the best ways are to get data from the internet to use in an application. For example, is it best to store the data in a MySQL database with PHP and then use C code and MySQL commands to get that data from my Mac app? Is JSON better? Any help would be awesome!
    Josh

    What kind of data are you after?
    Eric

  • Powerpivot Error on Refresh -- "We couldn't get data from the data model..."

    I'm using Excel 2013 and Windows 8.1.  I have a spreadsheet I've been using for over a year, and I've just started getting this error message when I try to refresh the data.
    "We couldn't get data from the Data Model.  Here's the error message we got:
    The 'attributeRelationship' with 'AttributeID' - 'PuttDistCat9' doesn't exist in the collection"
    Any idea how I can fix this problem?  I haven't changed anything related to that particular attribute.  All the data is contained in separate sheets in the workbook, so there are no external sources of data.
    Thanks.
    Jean

    Thanks for all the suggestions.
    I found a slightly older version of the spreadsheet that still refreshes properly, so I don't think I have any issues with the version of Excel or Power Query.  (I've had this same error before, and I believe I applied the hotfix at that time.)
    I think this problem started after I updated a number of the date filters in the pivot tables.  I haven't made any changes to the data model, and the only updates I've made were to add data (which I do all the time), and to change the date filters on
    the pivot tables.
    As suggested, I added a new pivot table querying one table (the table with the attribute that shows up in the error message), and it worked fine.  I can also refresh this pivot table.
    Then I tried adding a pivot table which went against several tables in the data model (including the table in question).  The pivot table seemed to return that data properly.  However, when I tried to refresh it, I got the same error message ("we
    couldn't get data from the data model..."). 
    Dany also suggested running the queries one at a time to see which one is in error.  Without checking all the pivot tables, it appears that any which use the table "HolePlayedStrokes" generate the error (this is the table with the attribute
    mentioned in the error message).  Pivot Tables without that particular table seem to refresh OK.  Unfortunately, that is the main table in my data model, so most of the pivot tables use it.
    Any other suggestions?  I'd be happy to send a copy of the spreadsheet.
    Thanks for all the help.
    Jean

  • DB Connect Load - "Unknow error while uploading data from the DB Table"

    Hi Experts,
    We have our BI7 system connected to Oracle DB based third party tool. The loads are performing quite well in DEV environment.
    I would like to know, how we transport DB Connect datasources to Quality systems? Any different process to be followed for DB Connect datasources?
    At present the connections between BI Quality and the third party quality systems are established. We transported the DataSource from BI DEV system to BI quality system, but on trigerring an infopackage we are not able to perform loads. It prompts - "Unknow error while uploading data from the DB Table".
    Also on comparing the DataSources in DEV system and Quality system there are no fields in "Proposal" tab of datasource in Quality system. Also I cannot change or activate Datasource in Quality system as we dont have change access in quality.
    Please advice.
    Thanks,
    Abhijit

    Hi,
    Sorry for bumping an old thread ....
    Did this issue get ever get resolved?
    I am facing the same one. The loads work successfully in Dev. The transport for DBConnect DS also moved in successfully.
    One strange this is that DB User for dev did not automatically change to db user from quality when I transported the DBConnect datasource. DBCon DS still shows me the DB User from Dev in Quality system
    I get "Unknown Error" whenever I trigger the data package.
    Advait

  • I want to get data from only RESB table without loss of any deltas

    i have to fetch the reservation details for the production orders.
    we are using descrete manufacturing method to keep track the Work in process and cost .
    for addition of components manually in the production order we can track thru change date i.e From AUFK table with field name AEDAT. for each time when we are adding the components the system will create a new line item In tableRESB-OBJNR(field)
    i need very few fields from RESB table to be pulled into SAP BW.
    how should i proceed creating a generic exractor without any loss of deltas.
    i want to get data from only resb table into sap bw.
    how should i proceed with Generice extractor with single table RESB and what would be the delta field . could any one throw some light .
    all answers would be rewarded with points

    I have few reports for BOM data is to be pull into bw
    all the reports contain the same tables Mentione below
    MAST- material to BOM LINK
    STKO- BOM header
    STPO- BOM ITEM
    STAS- BOM ITEM SELECTION
    how should i create ageneric datsource satisfying that all the data comes from these tables without fail of deltas,
    my doubts.1. Do i have to create a separate data sources (generic) for all these individually and load into separate ODS'S AND CLUB THEM into single ODS further.?
    if i create i dont know what should be delta field that has to be picked for each datasource
    2. Do i have to create a view on all these tables and create a generic datasource.if created what would be the delta field i have to select.
    could you pls let me know how should i pull the data without loosing any deltas
    could you pls let me know the flow with delta fields mentioned
    regards,
    P

Maybe you are looking for

  • How can i compare two databases and their tables

    i have a text.txt file then i will insert it into db_header and db_details db_header has tbl_pcountheader with fld_Rack_No(char) PK and fld_DateAdded(date) PK db_details has tbl_pcountdetails with fld_Rack_No(char) PK, fld_Barcode(char) PK and fld_Qu

  • ITunes can't find iTunes folder nor create a new one

    ONce I moved my iTunes folder to an external drive. Now I cannot start iTunes if my notebook is not connected to this external drive, like while on a trip. Appears like iTunes has made the external drive location as dafault location. I have even trie

  • E-mail router (On-premise) to CRM 2015 (On-line) connectivity issue

    Hello Experts, I was trying to configure e-mail router on my location environment (working on domain administrator credentials :)) to connect to CRM 2015 Online server (TRIAL version). Unfortunately during "Load data" process ("Users, Queues and Forw

  • Business Events Type Attachment

    Dear Experts, Greetings! We have been attaching attachments for business event types . Now Business want see how many attachments were attached for a particular event type. However we are able to get attachments for a specific event type now problem

  • Nivissvc dll error in LVRT

    Hi all, I am trying to use cRIO 9082 for image processing. When I try to deploy the vis , it shows deployed with errors. When I see the Error log it shows  LabVIEW: (Hex 0x627) The function name for the nivissvc.*:LV_AviMovieClose:C node cannot be fo