Create one tables from 2 different tables

Hi,
How I can create one table from 2 different tables. Source tables have data and I want to include it in new table.
I try this:
create table NEW_ONE
select * from OLD_ONE
union
select * from OLD_ONE2;
But it didn't work correctly :/

I don't have any error. This syntax create table NEW_ONE, but this table have columns only from OLD_ONE table :/ There aren't any column from OLD_ONE2 :/ Any suggestions?
I don't forget about "as" in my query, only in this post.
Edited by: tutus on Sep 8, 2008 6:36 AM

Similar Messages

  • Can we create one repository from different data Source

    Hi Experts
    I have one doubt
    1. Can we create one repository in OBIEE from different source like..
    I have three Database(Oracle) and i want to create one single repository from different source.
    2. If my Database are different like(Oracle,DB2,Teradata..)
    Thanks in advance
    Regards
    Frnds

    Hi..
    Yes It's possible to create a repository from different datasources, provided there should be different DSN for each...
    If it's ORACLE, we can import objects from OCI directly.. by mentioning the TNS Name, without creating DSN
    Thanks & Regards
    Kishore Guggilla

  • How to display multiple data from different table in one table? please help

    Hi
    I got sun java studio creator 2(the separate installation not the one in the net beans)....
    My question is about displaying data that have been taken from the database.... I know how to display data in a table(just click on the table "bind data" )... but my question is that:
    when i want to use a sql statement that taken the data from different table...
    how can i display that data in the table(that will be shown in the web) ??? when i click bind data on the table i can only select one table i can't select more than one....
    Note:
    1) i'm using the rowset for displaying the data in the table, since the sql statement is depending on a condition(i.e. select a from b where c= ? )...
    2) i mean by different table is that( i.e. select a from table1,table2 )..
    thanks in advance...

    Hi,
    937440 wrote:
    Hi every one, this is my first post in this portal. Welcome to the forum!
    Be sure to read the forum FAQ {message:id=9360002}
    I want display the details of emp table.. for that I am using this SQL statement.
    select * from emp where mgr=nvl(:mgr,mgr);
    when I give the input as 7698 it is displaying the corresponding records... and also when I won't give any input then it is displaying all the records except the mgr with null values.
    1)I want to display all the records when I won't give any input including nulls
    2)I want to display all the records who's mgr is null
    Is there any way to incorporate to include all these in a single query..It's a little unclear what you're asking.
    The following query always includes rows where mgr is NULL, and when the bind variable :mgr is NULL, it displays all rows:
    SELECT  *
    FROM     emp
    WHERE     LNNVL (mgr != :mgr)
    ;That is, when :mgr = 7698, it displays 6 rows, and when :mgr is NULL it displays 14 rows (assuming you're using the Oracle-supplied scott.emp table).
    The following query includes rows where mgr is NULL only when the bind variable :mgr is NULL, in which case it displays all rows:
    SELECT     *
    FROM     emp
    WHERE     :mgr     = mgr
    OR       :mgr       IS NULL
    ;When :mgr = 7698, this displays 5 rows, and when :mgr is NULL it displays 14 rows.
    The following query includes rows where mgr is NULL only when the bind variab;e :mgr is NULL, in which case it displays only the rows where mgr is NULL. That is, it treats NULL as a value:
    SELECT     *
    FROM     emp
    WHERE     DECODE ( mgr
                , :mgr, 'OK'
                )     = 'OK'
    ;When :mgr = 7698, this displays 5 rows, and when :mgr is NULL, it displays 1 row.

  • Report using Data from different tables

    Hello,
    I am trying to convert a Cobol batch program to Oracle 6i tabular report.
    The data is fetched from many different tables and there are lots of processing(i.e, based on the value of a column from one table need additional processing from different tables) required to generate the desired columns in the final report.
    I would like to know what is the best strategy to follow in Oracle Reports 6i. I heard that CREATE GLOBAL TEMPORARY TABLE is an option. ( or REF CURSOR ?) I do not know much about its usage. Can somebody guide me about this or any other better way to achieve the result.
    Thank you in advance
    Priya

    Hello,
    There are many, many options available to you, each of which has advantages and disadvantages. This is why it is difficult to answer "what is best?" without alot more details about your specific circumstances.
    In general, you're going to be writing PL/SQL to do any conditional logic that cannot be expressed as pure SQL. It can executed in the database, or it can executed within Reports itself. And most reports developers do some of both.
    As a general rule, you want to send only the data you need from the database to the report. This means you want to do as much filtering and aggregating of the data as is readily possible within the database. If this cannot be expressed as plain SQL queries, then you'll want to create a stored procedures to help do this work.
    Generally, the PL/SQL you create for executing within the report should be focused on control of the formatting, such as controlling whether a field is visible, or controlling display attributes for conditional formatting.
    But these are not hard and fast rules. In some cases, it is difficult to get all the stored procedures you might like installed into the database. Perhaps the dba is reluctant to let you install that many stored procedures. Perhaps there are restrictions when and how often updates can be made to stored procedures in a production database, which makes it difficult to incrementally adjust your reports based on user feedback. Or perhaps there are restrictions for how long queries are allowed to run.
    So, Reports offers lots of options and features to let you do data manipulation operations from within the report data model.
    In any case, Oracle does offer temporary table capabilities. You can populate a temp table by running stored procedures that do queries, calculations and aggregations. And you can define and initiate a dynamic query statement within the database and pass a handle to this query off to the report to execute (ref cursor).
    From the reports side, you can have as many queries as you want in the data model, arranged in any hierarchy via links. You can parameterize and change the queries dynamically using bind variables and lexicals. And you can add calculations, aggregations, and filters.
    Again, most people do data manipulation both in the database and in Reports, using the database for what it excels at, and Reports for what it excels at.
    Hope this helps.
    Regards,
    The Oracle Reports Team --skw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to join tables from different databases (DBLink/DB connection )

    Hello,
    i have an issue and i hope you could help me to solve it. My problem is: I want to create native sql select which joins two tables from different DB (both of them are ORACLE, one of them internal, another one - external). I have found several notes and posts, but without any success. Db connection exists in dbcon table, so this part of my problem has been solved.
    I would like something like that:
    select * from table1@xxx inner join table2.
    i can not split this select into two separate ones, because both tables store over 30 mln. entries and i do not want to create any copies of them.
    Br,
    dez

    Hi,
    you might need to create a DB-Link on DB level and use EXEC SQL.
    Lots of stuff on google about this, like
    Oracle DBLink ( external database )
    Volker

  • Fetch data from different tables print them is assigned places

    Hi Friends,
    I have designed one SMART-Form (Receipt).
    I need to fetch data from different tables and the data must be print in assigned places. Please help me how to achieve this requirement. Thanks for your help.
    Best regards,
    Manju.
    Edited by: Alvaro Tejada Galindo on Feb 12, 2008 10:20 AM

    U're right.
    When it creates a smartform it needs to decide when the main data have to be extracted:
    - or in driver program
    - or in smartforms
    The difference can be in the performance, because the program can select the data only once, the smartforms needs to extract them everytime it's called.
    I prefer to use a complex structure for the smartform interface as so all data I need are in only one structure, the problem is the complex structure is harder to be managed.
    Max

  • Accessing tables from different schema in CDS and AMDP

    Hi All,
    We are working on a HANA system which has several schema replicated from SAP R/3/Non SAP systems. We have BW 7.4 SP9 deployed on the same system and accessing the HANA views using latest BW virtual objects such as Open ODS , Composite providers etc.
    We are also using the BW system for few ABAP based data processing developments. We are currently accessing HANA views in ABAP programs by creating dictionary views based on external HANA views.
    We would like to however use recent possibilities of CDS and AMDP for better life cycle management of ABAP based solutions. The open SAP course on this subject was of very good help. Thanks a lot "open SAP team" for that. I would however have few open questions,
    As I understand AMDP gives us full flexibility of writing sql procedures within ABAP development environment, but can we access tables from different schema into AMDP code. If yes, then sample code would help.
    If the answer of first question is yes, then how do we manage transports between development and production systems where the schema names would be different. Currently in open HANA developments, such transport is manged using Schema mapping.
    Can I also use different schema tables in CDS views.
    We are updating few tables in ABAP dictionary after applying processing logic in ABAP program as detailed in step 1. With the new approach using AMDP, can we directly update database schema tables which will give us an optimization advantage.
    New ABAP HANA program interfaces are quite promising and we would like to use them to optimize many data intensive applications.
    Thanks & Regards,
    Anil

    Hi Anil,
    I can only answer 1. and 2. (and would be interested into 3. as well):
    1.
    Yes you can access tables from a different schema and also HANA views. In this case no 'using' is needed.
    Examples:
        RESULT = SELECT
        FROM
              "SAP_ECC"."T441V" AS t,
              "_SYS_BIC"."tmp.package/AFPO" AS a.
        WHERE ...
    2. In this case, if you need schema mapping: You could use HANA (projection) views which just forward to a different schema, also see example.
    Best regards,
    Christoph

  • How can I use create/createInsert for two different tables

    Hi All,
    I am showing different fields in the UI from different tables. I am able to fetch the data from all the tables and able to modify and save the data.
    Now, the problem when I want to create/insert some data into those columns(from different tables) I am facing issues.
    How can I proceed further??

    Hi Shay,
    Thank you very much for your quick response.
    Actually I am totally new in ADF world and I am trying to implement some applications in ADF.
    I created an UI based on some 3 tables(there is foreign key relation between them) and some other tables. I am able to modify and save my application if there is any data in all the tables.
    My Actual issues are
    1) I removed all the data from the tables. There is a submit(CreateInsert) button, what I expected is on click of the button I should see all the fields in editable mode. But I was able to see only few fields and also in readonly mode. So here my issue is how can i create and save these data.
    2) Consider on my landing page I have just CommandLink/CommandButton. After clicking that page I should get the above screen in create mode(I mean to say all fields in editable mode). How can achieve this?
    Thanks & Regards,
    Ravi.

  • How to get only column names from different tables as single table columns

    Hi All,
       I have one requirement in which we want only column names from different tables.
    for example :
     I have three tables T1 ,T2, T3 having
      col1 clo2 clo3 -->  T1 , 
      col3 col5 ,clo6 --> T2 ,
      Clo6 col8 col9 --> T3
    columns i want to get only all  Column names from all table as single Resultset not any data from that how can i get that empty resultset 
    because this empty result i want to bind in datagridview(front end) as Empty resultset 
    Please tell me anyways to do this
    Niraj Sevalkar

    If I understand you want an empty result set, just with metadata. SET FMTONLY do the trick:
    SET FMTONLY ON
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    SET FMTONLY OFF
    Another alternative is to include an imposible contition
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    WHERE 1 = 0
    If you are using a SqlDataAdapter in your client application. You can use the FillSchema method. the select command may be any select statement that returns the columns you want. Under the covers FillSchema will call SET FMTONLY ON.
    If you are using SqlCommand.ExecuteReader you can pass SchemaOnly to CommandBehavior argument. SET FMTONLY ON is called under the covers. Again the select command may be any select statement that returns the columns you want.
    "No darás tropezón ni desatino que no te haga adelantar camino" Bernardo Balbuena

  • How to do a SELECT from different tables into an internal table?

    How to do a SELECT from different tables into an internal table?
    I want to select data from MARA, MARC and ZPERSON and populate my ITAB_FINAL
    REPORT  zinternal_table.
    TABLES:
      mara,
      marc,
      zperson.
    TYPES:
    BEGIN OF str_table1,
      v_name LIKE zperson-zname,
      v_matnr LIKE marc-matnr,
      v_emarc LIKE marc-emarc,
      v_werks_d LIKE marc-werks_d,
      v_dstat LIKE marc-dstat,
      END OF str_table,
      i_table1 TYPE STANDARD TABLE OF str_table1.
    DATA:
    BEGIN OF str_table2,
    v_mandt LIKE mara-mandt,
    v_ernam LIKE mara-ernam,
      v_laeda LIKE mara-laeda,
    END OF str_table2,
    itab_final LIKE STANDARD TABLE OF str_table2.

    first find the link between mara , marc and zperson , if u have link to 3 tables then u can jus write a join and populate the table u want ( thats final table with all the fields).
    u defenitely have alink between mara and marc so join them and retrieve all data into one internal table.
    then for all the entries in that internal table retrieve data from zperson into another internal table.
    then loop at one internal table
    read another internal table where key equals in both the tables.
    finally assign fileds if sy-subrc = 0.
    gs_finaltable-matnr = gs_table-matnr
    etc...
    and finally append gs_finaltable to gt_finaltable.
    there u go ur final table has all the data u want.
    regards
    Edited by: BrightSide on Apr 2, 2009 3:49 PM

  • Retriving of data from different tables

    retriving of data from different tables depening of the primary key  this key field is there in all tables   if it is there in one v table it should continue to other tables otherwise it should get exit from that it should display information message or otherwise success  message if it is there in all tables .

    Im writing the concept, just check it.
    SELECT * from kna1 into lt_kna1.
    if sy-subrc eq 0.
       selest * from lfa1 into lt_lfa1
    for all entries in lt_kna1.
    endif.

  • Retrieving Data from different Tables with same tuple name

    Hi,
    I am made the following query from different tables. A tuple "name" is appearing in some tables. So when I run the qiery in a Java class, it delivers the same result of c.name, bpl.name and p.name. The result of c.name is correct, but the other 2 names are overwritten. It works perfect in a postgreSql query tool. How can I correct it, plz?
    SELECT c.ad_client_id, c.name, o.c_order_id, o.ref_order_id, bp.name, bpl.name, o.dateordered, o.datepromised, od.c_orderline_id,p.m_product_id,p.name, cur.iso_code, od.qtyordered
    FROM adempiere.ad_client c, adempiere.c_order o, adempiere.c_orderline od, adempiere.c_bpartner bp, adempiere.m_product p, adempiere.c_bpartner_location bpl, adempiere.c_currency cur
    WHERE c.ad_client_id =11 and c.ad_client_id = o.ad_client_id and bp.c_bpartner_id=o.c_bpartner_id and o.c_order_id = od.c_order_id and od.m_product_id = p.m_product_id and o.c_bpartner_location_id =bpl.c_bpartner_location_id and o.c_currency_id=cur.c_currency_id;
    Cheers

    Hi,
    create alias, if u have similar field names as below. Use the alias name (rs.getString("cname") and rs.getString("bpname") and so on ) to retrive data.
    SELECT c.ad_client_id, c.name as cname, o.c_order_id, o.ref_order_id, bp.name as bpname, bpl.name as bplname, o.dateordered, o.datepromised, od.c_orderline_id,p.m_product_id,p.name as pname, cur.iso_code, od.qtyordered
    FROM adempiere.ad_client c, adempiere.c_order o, adempiere.c_orderline od, adempiere.c_bpartner bp, adempiere.m_product p, adempiere.c_bpartner_location bpl, adempiere.c_currency cur
    WHERE c.ad_client_id =11 and c.ad_client_id = o.ad_client_id and bp.c_bpartner_id=o.c_bpartner_id and o.c_order_id = od.c_order_id and od.m_product_id = p.m_product_id and o.c_bpartner_location_id =bpl.c_bpartner_location_id and o.c_currency_id=cur.c_currency_id;Regards,
    Ram

  • Create a table from another table

    I have Windows XP with 10g 10.2.0.1.0
    I need to create a table from another table to re-arrange the table column order and add the following statement at the end of creation.
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"
    Below iis my SQL statement, but it doesn't work. Please help.
    create table my_table as (select t1, t5, t2, t3, t4 from orig_table
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"
    *);*

    Kee Kee wrote:
    I have Windows XP with 10g 10.2.0.1.0
    I need to create a table from another table to re-arrange the table column order Why? Column order has no meaning. The individual SELECT statement specifies the column order that particular statement wants, which may be different from the needs of some other SELECT statement.
    and add the following statement at the end of creation.
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"
    Below iis my SQL statement, but it doesn't work. Please help.
    create table my_table as (select t1, t5, t2, t3, t4 from orig_table
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"

  • Procedure to check data from different tables

    Hi
    I am trying to write a procedure to compare data from a table with another.
    Table 1
    ID Name Dept
    1 ABC Y
    2 DEF Z
    Table 2
    ID Dept
    1 Y
    2 Z
    Table 3
    Name ID
    1 ABC
    2 DEF
    I would like to compare each record data in Table 1 with data from different tables table2,table3 by matching ID,name.... Please help me with how I could start writing a procedure and also spool data that does not match from the table1 with other tables
    thanks
    Edited by: 890563 on Apr 30, 2012 10:34 AM

    Hope below helps you.
    CREATE TABLE TABLE1
    (    ID          VARCHAR2(10),
         FIRST_NAME  VARCHAR2(30),
         LAST_NAME   VARCHAR2(30),
         MIDDLE_NAME VARCHAR2(30)
    INSERT INTO TABLE1 VALUES('123456','testfirst','testlast','testmiddle');
    INSERT INTO TABLE1 VALUES('123457','testfirst1','testlast1','testmiddle1');
    CREATE TABLE TABLE1
    (    ID          VARCHAR2(10),
         FIRST_NAME  VARCHAR2(30),
         LAST_NAME   VARCHAR2(30),
         MIDDLE_NAME VARCHAR2(30)
    INSERT INTO TABLE2 VALUES('123456','testfirst','testlas','testmidd');
    INSERT INTO TABLE2 VALUES('123457','testfirst2','testlast1','testmiddle1');
    SELECT TABLE1.ID,
            -- Match First Name
         CASE WHEN TABLE1.FIRST_NAME != TABLE2.FIRST_NAME THEN TABLE1.FIRST_NAME ELSE NULL END TABLE1_FIRST_NAME,
         CASE WHEN TABLE1.FIRST_NAME != TABLE2.FIRST_NAME THEN TABLE2.FIRST_NAME ELSE NULL END TABLE2_FIRST_NAME,
            -- Match Middle Name
         CASE WHEN TABLE1.MIDDLE_NAME != TABLE2.MIDDLE_NAME THEN TABLE1.MIDDLE_NAME ELSE NULL END TABLE1_MIDDLE_NAME,
            CASE WHEN TABLE1.MIDDLE_NAME != TABLE2.MIDDLE_NAME THEN TABLE2.MIDDLE_NAME ELSE NULL END TABLE2_MIDDLE_NAME,
            -- Match Last Name
         CASE WHEN TABLE1.LAST_NAME != TABLE2.LAST_NAME THEN TABLE1.LAST_NAME ELSE NULL END TABLE1_LAST_NAME,
            CASE WHEN TABLE1.LAST_NAME != TABLE2.LAST_NAME THEN TABLE2.LAST_NAME ELSE NULL END TABLE2_LAST_NAME
    FROM  TABLE1, TABLE2
    WHERE TABLE1.ID = TABLE2.ID
    ID         TABLE1_FIRST_NAME  TABLE2_FIRST_NAME  TABLE1_MIDDLE_NAME TABLE2_MIDDLE_NAME TABLE1_LAST_NAME   TABLE2_LAST_NAME
    123456     NULL               NULL               testmiddle         testmidd           testlast        testlas
    123457     testfirst1         testfirst2         NULL               NULL               NULL            NULL
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Comparing two records from different tables error.

    Hi folks!
    I have this PL/SQL Block.
    I want to compare the only one record from both tables to see if the content of them are equal or not, but I don't want to specified column by column to do that.
    Any idea?
    Thanks a lot in advanced,
    Abdel E. Miranda S.
    Panama
    declare
    cursor c_aems_prueba is
    select nombre, direccion, telefono, limite, seq
         from aems_prueba;
    cursor c_aems_testing is
    select nombre, direccion, telefono, limite, seq
         from aems_testing;
    vc_aems_prueba c_aems_prueba%rowtype;
    vc_aems_testing c_aems_testing%rowtype;
    vt_aems_prueba aems_prueba%rowtype;
    vt_aems_testing aems_testing%rowtype;
    begin
    insert into aems_prueba
    values('ABDEL MIRANDA', 'PAITILLA', '215-3411', 1000, 1);
    insert into aems_testing
    values('ABDEL MIRANDA', 'PAITILLA', '215-3411', 1000, 1);
    commit;
    open c_aems_prueba;
    fetch c_aems_prueba into vt_aems_prueba;
    open c_aems_prueba;
    fetch c_aems_prueba into vt_aems_testing;
    if vt_aems_prueba = vt_aems_prueba
    then
         dbms_output.put_line('son iguales las variables, si funciona la comparacion de dos estructuras');
         else
         dbms_output.put_line('no son iguales las variables, no funciona la comparacion de dos estructuras');
    end if;
    close c_aems_prueba;
    close c_aems_testing;
    end;

    Satyaki De,
    Java is involving because an Outsourcing new project. The outsourcing company is developing the new application using JSF which invoke an interface java method [depending of the operation: select, update, insert] and them invoke the PLSQL API to precess tha operation.
    In the case I already wrote here, the issue is this:
    The user search for a specific data using the interface. The java method send a request for these operation through the API. the PLSQL process the request and return a beam, with all the column the user look for.
    The user see the information in the application windows. Assuming the user wants to change some data, he modify just one field [lets say telephone number] and press the update button. The application process the request using a different method, which invoke a different function within the PLSQL API.
    Once the information is returning to the API, I must know if at least one field change its value. So I was thinking to get the beam with the data before it was changed and compare it with the beam with the changing data.
    If current_beam = new_beam
    then
    update
    else
    no change to process
    end if;
    Any idea.

  • How do you join two tables from different Oracle schemas using a subquery

    I am trying to join two tables from different Oracle schemas using a subquery. I can extract data from each of the tables without a problem. However, when I combine the select statements using a subquery I get the Oracle error *'ORA-00936: missing expression'*. Since each SELECT statement executes on its own without error I don't understand what is missing. The result set I am trying to get is to match up the LINE_ID from PDTABLE_12_1 in schema DD_12809 with the MAT_DESCRIPTION from table PDTABLE_201 in schema RA_12809.
    The query is as follows:
    sql = "SELECT [DD_12809].[PDTABLE_12_1].LINE_ID FROM [DD_12809].[PDTABLE_12_1] JOIN " _
    + "(SELECT [RA_12809].[PDTABLE_201].MAT_DESCRIPTION " _
    + "FROM [RA_12809].[PDTABLE_201]) AS FAB " _
    + "ON [DD_12809].[PDTABLE_12_1].PIPING_MATER_CLASS = FAB.PIPING_MATER_CLASS"
    The format of the query is copied from a SQL programming manual.
    I also tried executing the query using a straight JOIN on the two tables but got the same results. Any insight would be helpful. Thanks!
    Edited by: user11338343 on Oct 19, 2009 6:55 AM

    I believe you are receiving the error because you are trying to JOIN on a column that doesn't exist. For example you are trying to join on FAB.PIPING_MATER_CLASS but that column does not exist in the subquery.
    If you want to do a straight join without a subquery you could do the following
    SELECT  DD_12809.PDTABLE_12_1.LINE_ID
    ,       FAB.MAT_DESCRIPTION
    FROM    DD_12809.PDTABLE_12_1
    JOIN    RA_12809.PDTABLE_201    AS FAB ON DD_12809.PDTABLE_12_1.PIPING_MATER_CLASS = FAB.PIPING_MATER_CLASS  HTH!

Maybe you are looking for