Help required in sql join

Hello Friends ,
I am trying query a record from two tables Emp and Dept , i would like to know the where employee works (Location is stored in
dept table ) and would like to know employee belongs to which manager( Manager Id stored in Emp table ) .
The below query is not giving me the desired output . Please suggest me something .
SELECT
E1.EMPNO,
E1.ENAME,
E1.JOB,
E1.SAL,
E1.DEPTNO,
TO_CHAR(E1.HIREDATE,'MM-DD-YYYY') HIRE_DATE,
D.LOC,
E1.ENAME Manager
FROM EMP E1,EMP E2,DEPT D
WHERE E1.DEPTNO=D.DEPTNO
AND E2.MGR= E1.EMPNO;
Keerthi

Next time ask similar questions in sql forum
PL/SQL
Answer to your question is
(based on the assumption MGR_NO column exists and is the manager empno)
SELECT E1.EMPNO,
E1.ENAME,
E1.JOB,
E1.SAL,
E1.DEPTNO,
TO_CHAR (E1.HIREDATE, 'MM-DD-YYYY') HIRE_DATE,
D.LOC,
E2.ENAME Manager
FROM EMP E1, EMP E2, DEPT D
WHERE E1.DEPTNO = D.DEPTNO AND E2.EMPNO = E1.MGR_NO;

Similar Messages

  • Help required in SQL query

    I have a table and cols as below:
    START DATE     TOTAL DAYS
    10/11/2011 15:00      1
    10/15/2011 5:00      1
    12/22/2011 10:00     1
    12/22/2011 11:00     2
    12/30/2011 10:00     1
    1/1/2012 1:00     1
    1/1/2012 10:00     1
    1/1/2012 16:00     2
    1/2/2012 14:00     1
    1/3/2012 15:00     1
    1/4/2012 15:00     2
    1/4/2012 18:00     1
    I need to query where the values from the above table
    should return values like below:
    I tried many ways but could not find suitable solution.
    Kindly help me in this regard.
    START DATE     TOTAL DAYS
    10/11/2011 15:00     1
    10/15/2011 5:00     1
    12/22/2011 11:00     2
    12/30/2011 10:00     1
    1/1/2012 16:00      2
    1/2/2012 14:00      1
    1/3/2012 15:00      1
    1/4/2012 15:00     2
    ultimate goal is to sum up the all numbers TOTAL DAYS column in the second table... All task should be handled in single query. I cannot use java coding to handle this as my requirement needs to be included in the query which exists already.
    Edited by: 915175 on Feb 16, 2012 11:02 PM

    select trunc(start_date), max(start_date), max(total_days) from tablename
    group by trunc(start_date);Please check below Test done at my local site with you data:
    SQL>
    SQL> with tablename as
      2  (
      3  select to_date('10/11/2011 15:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
      4  select to_date('10/15/2011 5:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
      5  select to_date('12/22/2011 10:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
      6  select to_date('12/22/2011 11:00' , 'mm/dd/yyyy hh24:mi') start_date,  2 total_days from dual union all
      7  select to_date('12/30/2011 10:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
      8  select to_date('1/1/2012 1:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
      9  select to_date('1/1/2012 10:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
    10  select to_date('1/1/2012 16:00' , 'mm/dd/yyyy hh24:mi') start_date,  2 total_days from dual union all
    11  select to_date('1/2/2012 14:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
    12  select to_date('1/3/2012 15:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual union all
    13  select to_date('1/4/2012 15:00' , 'mm/dd/yyyy hh24:mi') start_date,  2 total_days from dual union all
    14  select to_date('1/4/2012 18:00' , 'mm/dd/yyyy hh24:mi') start_date,  1 total_days from dual
    15  )
    16  select  TO_CHAR(max(start_date),'MM/DD/YYYY HH24:MI') start_date , max(total_days) total_days from tablename
    17  group by trunc(start_date);
    START_DATE       TOTAL_DAYS
    10/15/2011 05:00          1
    01/03/2012 15:00          1
    12/30/2011 10:00          1
    01/01/2012 16:00          2
    10/11/2011 15:00          1
    12/22/2011 11:00          2
    01/04/2012 18:00          2
    01/02/2012 14:00          1
    8 rows selected.
    SQL>Regards,
    Dipali..
    Update: Added test done at my database..
    Edited by: Dipali Vithalani on Feb 16, 2012 11:18 PM

  • *URGENT HELP REQUIRED* java.sql.SQLException: Invalid Oracle URL specifed

    Hi all,
    In the middle of the last week for my final year project and having to convert to an Oracle database due to compatibility problems with university Tomcat Server and MS Access. I'm having trouble connecting to the Oracle database and would appreciate some help please.
    Running on Windows 98 in the lab here, and the Oracle 9i, release 9.2.0.2.0, J2SDK1.4.0, Classes12.zip installed OK.
    Code for connection looks like this inside the constructor of my class:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    cardSaleConnexion = DriverManager.getConnection("jdbc:oracle:[email protected]:1521:sid","user_name","pwdt");
    System.out.println("Connection Successful ");
    And I'm getting the following error when calling the constructor in a driver program:
    java.sql.SQLException: Invalid Oracle URL specified
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:188)
         at java.sql.DriverManager.getConnection(DriverManager.java:512)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at CardSale.<init>(CardSale.java:30)
         at Driver.main(Driver.java:11)
    Exception in thread "main"
    Please reply on a very urgent basis.
    Kind regards,
    Peter

    Try ojdbc14.jar as the JDBC driver instead of classes12.zip.
    Refer:
    http://otn.oracle.com/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
    http://docs.sun.com/source/817-5603-10/index.html
    Database Driver
    This section describes the known database driver issues and associated solutions.
    ID      Summary
    4700531      On Solaris, an ORACLE JDBC driver error occurs.
         This new Java Database Connectivity (JDBC) driver is for Oracle (R) working with JDK1.4. The problem is caused by a combination of the Oracle 9.1 database and ojdbc14.jar. Applying the patch will fix the problem on Solaris 32-bit machine, running an Oracle 9.0.1.3 database.
         Solution
         Obtain and apply the patch to your server from the Oracle Web site for Bug 2199718. Perform the following steps:
         1.��Go to the Oracle web site.
         2.��Click the 'patches' button.
         3.��Type 2199718 in the patch number field.
         4.��Click the 32-bit Solaris OS patch.Go to Metalink.oracle.com.
         5.��Click patches.
         6.��Under patch number, enter 2199718.
         7.��Click the 32 bit Solaris OS patch.
    4707531      On Solaris, accessing an Oracle 9.1 database with an Oracle 9.2 Client may cause data corruption.
         If you use an Oracle (R) 9.2 client to access an Oracle 9.1 database, data corruption might occur when a number column follows a timestamp column.
         The problem might be caused by using the ojdbc14.jar file with an Oracle 9.1 database. Applying the patch might assist in addressing the situation on Solaris 32-bit machines, running an Oracle 9.1 database. This JDBC driver is for Oracle working with JDK1.4.
         Solution
         Obtain the patch that Oracle might make available from the Oracle web site for Bug 2199718 and apply it to your server.
    Regards,
    Pankaj D.

  • Help Required With SQL Subquery Across DB Link - Takes Long Time

    Hi,
    Apologies if this is not the correct forum but I am implementing this through HTMLDB.
    I am trying to run a SQL query over a DB link with a sub query on tables in my HTMLDB workspace.
    The SQL query over the database link takes 1.23 seconds to run on it's own:
    SELECT D.EMAIL_ADDRESS,
    D.COL2,
    D.COL3,
    D.COL4,
    D.COL5,
    D.COL6,
    T.COL1
    FROM SCHEMA.TABLE1@DATABASELINK D,
    SCHEMA.TABLE2@DATABASELINK T
    WHERE D.TABLE_JOIN = T.TABLE_JOIN
    AND T.COL1 = '1111111'
    AND UPPER(D.COL2) IN ('XXXXXX','YYYYYY')
    The SQL query based on HTMLDB workspace tables takes 0.01 seconds to run on it's own:
    SELECT UPPER(A.EMAIL_ADDRESS)
    FROM HTMLDBTABLE1 M, HTMLDBTABLE2 A
    WHERE M.TABLE_JOIN = A.TABLE_JOIN
    AND M.ID = 222
    However when I try and run these together the results take 280 seconds to complete:
    SELECT D.EMAIL_ADDRESS,
    D.COL2,
    D.COL3,
    D.COL4,
    D.COL5,
    D.COL6,
    T.COL1
    FROM SCHEMA.TABLE1@DATABASELINK D,
    SCHEMA.TABLE2@DATABASELINK T
    WHERE D.TABLE_JOIN = T.TABLE_JOIN
    AND T.COL1 = '1111111'
    AND UPPER(D.COL2) IN ('XXXXXX','YYYYYY')
    AND NOT EXISTS
    (SELECT UPPER(A.EMAIL_ADDRESS)
    FROM HTMLDBTABLE1 M, HTMLDBTABLE2 A
    WHERE M.TABLE_JOIN = A.TABLE_JOIN
    AND UPPER(A.EMAIL_ADDRESS) = UPPER(D.EMAIL_ADDRESS)
    AND M.ID = 222)
    Does anyone have any idea why this query is taking so long?
    Please let me know if you require additional information.
    Many thanks,
    Richard.

    I've updated my profile to show my email address, so go ahead and email me the strace output (compressed please). Maximum attachment size for emails to Oracle is 10MB (encoded), so split the strace output in 5MB chunks if necessary.
    poll() is not normally used by the Oracle network layer for client-server connections. So this may be related to an OS network service, such as DNS or NIS. The strace should make this clear (to me anyway).
    Edited by: herb on Aug 14, 2009 10:25 AM

  • Help required in SQL Loader

    Is it possible to load a single target file from multiple flat file sequentially using SQL Loader?
    Example -
    Table structure -
    <Emp_id><Emp_Name><Dept_id><Total_sales><Commission>
    <Emp_id><Emp_Name><Dept_id> column will be load from Emp_master flat file
    <Total_sales> column will be load from sales flat file - there will be two fields emp_id and total_sales
    <Commission> column will be load from commission flat file - there will be two fields emp_id and commission.
    I have tried this to merge these three flat file and create a single flat file, but in my real requirement i found it is quite tedious.
    Is there any other approach?
    Thanks in Advance

    You can load into 3 temporary tables and insert into main table using a query
    OR
    You can use shell script (I hope UNIX environment) to merge the files
    There is no direct way to load the data for same row from multiple files using SQL * Loader

  • Help required in SQL

    I fired the following query successfully: -
    select year, to_char(to_date(MONTH, 'Month'),'MM')
    from MHS
    but when I try to take a count of the records using the same query I get an error: -
    select year, to_char(to_date(MONTH, 'Month'),'MM'), count(0)
    from MHS
    group by year, to_char(to_date(MONTH, 'Month'),'MM')
    Please help. I am using Oracle 9.2

    select year, to_char(to_date(MONTH, 'Month'),'MM')
    from MHS
    ORA-01843: not a valid month
    Please note that it is working fine while I am not taking a count of the records. It is
    giving the error when I group the records.You are using Toad or some other application that does not fetch the all the rows. If you go to the end of the result set your first query will give the same error also.
    This is because you are not storing dates as dates, but separate text columns, and surprisingly you now have bad data in there.

  • Help required in SQL Tuning

    Hi
    SQL : 1
    Following Hierarchical SQL giving output with 2 seconds with 1169 records.
    SELECT LPAD ('.', 2 * (LEVEL - 1), '.') || LEVEL bom_level,
    msia.segment1
    || '.'
    || msia.segment2
    || '.'
    || msia.segment3
    || '.'
    || msia.segment4 parent_item_code,
    msia.description parent_description, msia.primary_unit_of_measure,
    LPAD ('.', 2 * (LEVEL - 1), '.')
    || msic.segment1
    || '.'
    || msic.segment2
    || '.'
    || msic.segment3
    || '.'
    || msic.segment4 component_item_code,
    msic.description component_description, bic.operation_seq_num,
    bic.component_quantity
    FROM bom_bill_of_materials bom,
    bom_inventory_components bic,
    mtl_system_items msia,
    mtl_system_items msic
    WHERE bic.bill_sequence_id = bom.bill_sequence_id
    AND msia.inventory_item_id = bom.assembly_item_id
    AND msia.organization_id = bom.organization_id
    AND msic.inventory_item_id = bic.component_item_id
    AND msic.organization_id = bom.organization_id
    START WITH bom.assembly_item_id = 1407543
    AND bom.organization_id = 56
    CONNECT BY bom.assembly_item_id = PRIOR bic.component_item_id
    AND bom.organization_id = 56;
    SQL : 2
    Following SQL giving output = 1407543
    SELECT e.equipment_item_id FROM websupp.epa_transaction_header e WHERE equipment_id = 34
    Now, when I am replacing START WITH clause of SQL:1 with SQL:2 means to replace 1407543 with SQL:2, it is taking so long time .
    Can you guide me in tuning SQL :1
    Thanks in advance
    Sanjay

    try something
    with t as
    SELECT e.equipment_item_id val FROM websupp.epa_transaction_header e WHERE equipment_id = 34
    SELECT LPAD ('.', 2 * (LEVEL - 1), '.') || LEVEL bom_level,
    msia.segment1
    || '.'
    || msia.segment2
    || '.'
    || msia.segment3
    || '.'
    || msia.segment4 parent_item_code,
    msia.description parent_description, msia.primary_unit_of_measure,
    LPAD ('.', 2 * (LEVEL - 1), '.')
    || msic.segment1
    || '.'
    || msic.segment2
    || '.'
    || msic.segment3
    || '.'
    || msic.segment4 component_item_code,
    msic.description component_description, bic.operation_seq_num,
    bic.component_quantity
    FROM bom_bill_of_materials bom,
    bom_inventory_components bic,
    mtl_system_items msia,
    mtl_system_items msic,
    t t
    WHERE bic.bill_sequence_id = bom.bill_sequence_id
    AND msia.inventory_item_id = bom.assembly_item_id
    AND msia.organization_id = bom.organization_id
    AND msic.inventory_item_id = bic.component_item_id
    AND msic.organization_id = bom.organization_id
    START WITH bom.assembly_item_id = t.val --1407543
    AND bom.organization_id = 56
    CONNECT BY bom.assembly_item_id = PRIOR bic.component_item_id
    AND bom.organization_id = 56;

  • SQL Join Help

    SQL Experts,
    I have a query below. Can I improve the SQL joining order in highlighted section - Lines 31 to 40
    SNIOTM.SNI_PA_OTM_ARC_DRVR -- around 200K rows
    SNIOTM.SNI_PA_ORD_SHP_STATUS -- 8 rows
    Edited by: 922411 on May 12, 2013 7:42 PM

    922411 wrote:
    SQL Experts,
    I have a query below. Can I improve the SQL joining order in highlighted section - Lines 31 to 40
    SNIOTM.SNI_PA_OTM_ARC_DRVR -- around 200K rows
    SNIOTM.SNI_PA_ORD_SHP_STATUS -- 8 rowsYou need not worry about the Joining Order, Oracle CBO is efficient enough to choose the Most Efficient way of joining the tables. However, it will depend on your Oracle Version, which you have not mentioned. If you are 10g or higher then you certainly need not worry.
    If you sense a problem in performance of query, then I will suggest you read the linked threads in {message:id=9360003} and post the details as specified.
    Only this will help us provide releavant suggestions and avoid guessing games.
    PS:- Do not forget to post Oracle Version and the Explain Plan in {noformat}{noformat} tags, exactly as specified.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help - Bean Binding an SQL join to a gui component(jtable) in Netbeans?

    Good afternoon. I'd like to ask if there is a way to data bind an SQL Join from 2 or more tables to a
    GUI component(Jtable) in Netbeans. All the tutorials show is how to bind all the fields of 1 database table
    to the component. Under the BIND/ELements option the IMPORT DATA TO FORM menu only allows
    you to choose 1 among the database tables from a selected database.
    Is there a way to configure an SQL query and attach it to the component?
    Thanks.

    This is not a Swing problem. Try a NetBeans forum.

  • Why Data Sort is required for Merge Join Transformation

    hi,
    In my understanding Merge Join works very similar to T SQL joins. But I am trying to understand why Sort is a compulsory requirement? I have looked into following article but not helpful
    http://technet.microsoft.com/en-us/library/ms137653(v=sql.105).aspx
    aamertaimor
    aamertaimor

    Merge Join is going to walk through two sets in the order that you gave in your input or using the Sort transformation. So, it loads one record from one input and one record from the second input.  If the keys match, it will output the row with information
    from both inputs.  If the left input has a value that is less than the value in right input, then either the row from the left input is sent out with no right input information (if there is an outer join) or if the join is an inner join, the
    Merge Join component will get the next row from Left input.  If the right input has a value that is less than the value that in the left input, then if there is a full outer join, output the right input with no left input information otherwise, get the
    next row from the right input.
    Here is the beauty, SSIS only needs to retain a couple rows in memory.
    What if Microsoft decided that there is no requirement for sorting?  Then in order for the Merge join to work is that it would load all of the rows from one input into memory and then the Merge Join would look up the row in memory.  That means
    a large amount of memory would be needed.
    By the way, if you want Merge Join behavior without the sort, use a Lookup component.
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • SQL JOIN with BPM sql component

    Hello friends.
    How to use SQL JOIN with BPM sql component?
    The tables objects are created but the joined tables belong to different sql components .
    I tried something like that, but a error "table doesn't exist" occours.
    Ex:
    for each element in
    SELECT imuImovelCd
    FROM IMOVEIS_URBANOS,
    Integracao.FGLP.IMOVEIS_PRE_EDITAIS
    WHERE IMOVEIS_URBANOS.imuImovelCd = Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipeImuCd
    AND Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedNr = 1
    AND Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedAa = 2008
    do
    extend this.imoveis using cdImovel = element.imuimovelcd,
                                  nrImovel = call(DEC_ENDERECO, codimovel : element.imuimovelcd, tipoimovel : 1)
    end
    Edited by: user9008295 on 26/01/2010 05:19

    ok, ok you are right.
    When I try use SQL Statement to make a JOIN with 2 tables on different sql objects, BPM returns "table dosn't exists".
    So.... I change my code. I dont know if this is the best way to do, but... i hope u, or everyone, can help me to do a best work.
    This code works fine.
    for each element in
    SELECT ipeImuCd
         FROM Integracao.FGLP.IMOVEIS_PRE_EDITAIS
         WHERE Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedNr = 1
         AND Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedAa = 2008
    do
         for each element2 in
              SELECT imuImovelDv
              FROM IMOVEIS_URBANOS
              WHERE imuImovelCd = element.ipeImuCd
         do
              extend this.imoveis using cdDvImovel = String(element2.imuImovelDv),
                                            cdImovel = Decimal(element.ipeImuCd),
                                            endereco = call(DEC_ENDERECO, codimovel : element.ipeImuCd, tipoimovel : 1)
         end
    end
    Thx a lot!!!

  • Network requirements for SQL Server Replication

    Hi,
    Can any one tell me what is network requirements for SQL Server replication.
    I have successfully configured the replication on LAN with active directory but I am unable to configure it on WAN.
    Can anyone tell me how WAN can be configured for sql server replication. 
    Any help in this regard will be highly appreciated.
    Regards,
    Muhammad Imran

    Hi Muhammad,
    In addition to Prashanth’s post, please also check the following things  to optimize SQL Server replication with a WAN link.
    • Initialize the Subscriber from a backup.
    Publishing the execution of stored procedures as opposed to replicating each operation performed by the stored procedure.
    Leveraging Subscription Streams.
    For more information, please review the following blog:
    http://sqlblog.com/blogs/argenis_fernandez/archive/2011/05/31/transactional-replication-and-wan-links.aspx
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • Converting oracle join to Ansi sql join

    Hi Guys,
    I am new to SQL and trying to convert the following Oracle query (joins) into ANSI sql joins...Can someone please help me?
    SELECT M.EXTERNALCODE, M.NAME AS MNAME, SC.BIRIM, SM.TRANSACTIONDATE, SMD.AMOUNT,
    SMD.UNITPRICE, SM.ID AS SMID, SMD.ID AS SMDID, F.NAME AS FNAME,
    IFNULL (SMD.AMOUNT, 0, SMD.AMOUNT) * IFNULL (SMD.UNITPRICE, 0, SMD.UNITPRICE) AS TOTALPRICE, SMD.AMOUNT AS RECEIVED_QUANTITY,
    PD.ORDERID, PD.AMOUNT QUANTITY, PO.PROCESSDATE
    FROM STOCKMAINTRANSACTION SM,
    STOCKMAINTRANSACTIONDETAIL SMD,
    MATERIAL M,
    STOCKCARD SC,
    FVSTOCK FVS,
    FIRM F,
    PURCHASEORDER PO,
    PURCHASEORDERDETAIL PD,
    PURCHASEORDERDETAILSUPPLIED PDS
    WHERE SM.ID = SMD.MAINTRANSACTIONID
    AND SMD.MATERIALID = M.ID
    AND SMD.STOCKCARDID = SC.ID
    AND SM.PROPREF = FVS.RECORDID(+)
    AND FVS.FIELDID(+) = 2559
    AND FVS.FLEVEL(+) = 'F'
    AND F.ID(+) = SUBSTR (FVS.FVALUE, 1, 9)
    AND SM.TRANSDEFID in (999,2329,2344,2370,150000903,150005362)
    AND SMD.CANCELLED = 0
    AND SMD.STOCKUPDATED = 1
    AND SMD.ID = PDS.STOCKMAINTRANSACTIONDETAILID
    AND PDS.ORDERDETAILID = PD.ORDERDETAILID
    AND PO.ORDERID = PD.ORDERID
    AND (M.ID = {@MATERIALID@} OR {@MATERIALID@} = 0)
    AND (SM.STOREID = {@STOREID@} OR {@STOREID@} = 0)
    AND (F.ID = {@SUPPLIERID@} OR {@SUPPLIERID@} = 0)
    AND SM.TRANSACTIONDATE BETWEEN {@STARTDATE@} AND {@ENDDATE@}
    ORDER BY F.NAME, M.EXTERNALCODE, SM.TRANSACTIONDATE
    Really appreciate the help!
    Thanks.

    Hi,
    Welcome to the forum!
    To convert to ANSI syntax, replace join conditions in the WHERE clause
    FROM           x
    ,             y
    WHERE         x.x1  = y.y1
    AND           x.x2  = y.y2with ON conditions in the FROM clause:
    FROM           x
    JOIN             y   ON    x.x1  = y.y1
                             AND   x.x2  = y.y2In inner joins, conditions that do not reference 2 tables are not really join conditions, so it doesn't matter if they are in the FROM clause or in the WHERE clause.
    In your case
    SM.TRANSDEFID in (999,2329,2344,2370,150000903,150005362)could be part of a join condition involving sm, or it could be in the WHERE clause. Most people find it clearer if 1-table conditions like this are in the WHERE clause.
    Again, this only applies to inner joins. For outer joins, all conditions that apply to a table that may lack matching rows must be included in the FROM clause, like this:
    LEFT OUTER JOIN  fvstock   fvs  ON   sm.propref       = fvs.recordid
                                    AND  fvs.fieldid  = 2559
                        AND  fvs.flevel   = 'F'Try it.
    If you have trouble, post your best attempt, along with CREATE TABLE and INSERT statements for a little sample data from all the tables involved, and the results you want from that data. Simplify the problem. Post only the tables and columns that you don't know how to handle.
    See the forum FAQ {message:id=9360002}
    user8428528 wrote:
    AND (M.ID = {@MATERIALID@} OR {@MATERIALID@} = 0)
    AND (SM.STOREID = {@STOREID@} OR {@STOREID@} = 0)
    AND (F.ID = {@SUPPLIERID@} OR {@SUPPLIERID@} = 0)
    AND SM.TRANSACTIONDATE BETWEEN {@STARTDATE@} AND {@ENDDATE@}This is not valid Oracle SQL. Is {@MATERIALID@} some kind of variable?

  • Requirements of SQL Server 2005 Stored Procedures to Develop Crystal Report

    Hi All,
       I want to learn how to create crystal report off of SQL Server 2005 Stored Procedure. So anybody please let me know from where I can download the documentation on "Requirements of SQL Server 2005 Stored Procedures for crystal report.
      I am using Crystal Report XI. Any help is greatly appreciated.
    Thank You.

    Hello,
    When CR uses Stored Porcedures we only look at the last SELECT statement. We can't use TMP tables because they are owned by the system and not the user. Even though you created them under your logon credentials you are not the actual owner. Or so I have found so far.... CR does not have permissions to get to those temp tables. If you can find out dynamically what the table names are called then it may work. I don't have a sample but it has the usual table info with a random GUID or temp name, really long, and changes every time.
    What should work is create a real table, not one of MS's tempTables and then push all your data to that table and then the last select statement returns all of your data from that temp table:
    SELECT * FROM MYTEMPTABLE.DBO.TABLE.
    Then CR should ahve no issues.
    It may be that the JDBC driver has problems. Test it using OLE DB or ODBC.
    Thanks again
    Don

  • XSLT mapping Help Required.

    XSLT mapping Help Required.
    Hi Experts,
    I am New to XSLT Mapping. I am practising the below Example:
    InputXML File:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="Persons111.xsl"?>
    <ns0:MT_XSLT_Source xmlns:ns0="http://XYZ.com/gen">
    <Person>
    <FirstName>Anshul</FirstName>
    <LastName>Chowdhary</LastName>
    <Gender>Male</Gender>
    <Address>
    <Street>2nd Main</Street>
    <Houseno>83/b</Houseno>
    <City>Mysore</City>
    </Address> </Person>
    </ns0:MT_XSLT_Source>
    XSL StyleSheet File:
    <?xml version='1.0' encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/Gen"
    Xmlns:ns1=”http://XYZ.com/Test”>
    <xsl:template match="/">
    <ns1:MT_XSLT_Target>
    <Title> <xsl:value-of select="ns0:MT_XSLT_Source/Person/Gender"/> </Title>
    <Name> <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '), ns0:MT_XSLT_Source/Person/LastName)"/>
    </Name>
    <Street> <xsl:value-of select="concat(concat(ns0:Mt_XSLT_Source/Person/Address/Houseno,' '),
    ns0:Mt_XSLT_Source/Person/Address/Street)"/> </Street>
    <City> <xsl:value-of select="ns0:Mt_XSLT_Source/Person/Address/City"/> </City>
    </ns1:MT_XSLT_Target>
    </xsl:template>
    </xsl:stylesheet>
    The Desired Output shuold be:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:MT_XSLT_Target xmlns:ns1="http://XYZ.com/Test">
    <Title>Male</Title>
    <Name>Anshul Chowdhary</Name>
    <Street>83/b 2nd Main</Street>
    <City>Mysore</City>
    </ns1:MT_XSLT_Target>
    I have refered the xsl in xml and i am getting the below Oupt in a Single line like this:
    Anshul Chowdhary Male 2nd Main 83/b Mysore
    I am Unable to display in Target XML Fomrat as shown above. Please check and do the needful.
    Regards,
    GIRIDHAR

    Hi,
    I have used below for testing.
    Input xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="Persons111.xsl"?>
    <ns0:MT_XSLT_Source xmlns:ns0="http://XYZ.com/gen">
    <Person>
    <FirstName>Anshul</FirstName>
    <LastName>Chowdhary</LastName>
    <Gender>Male</Gender>
    <Address>
    <Street>2nd Main</Street>
    <Houseno>83/b</Houseno>
    <City>Mysore</City>
    </Address> </Person>
    </ns0:MT_XSLT_Source>
    xsl code:
    <?xml version='1.0' encoding="UTF-8"?> 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/gen" 
        xmlns:ns1="http://XYZ.com/Test"> 
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> 
        <xsl:template match="/"> 
            <ns1:MT_XSLT_Target> 
                <Title> <xsl:value-of select="ns0:MT_XSLT_Source/Person/Gender"/> </Title> 
                <Name> <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '), ns0:MT_XSLT_Source/Person/LastName)"/> 
                </Name> 
                <Street> <xsl:value-of select="concat(concat(/ns0:MT_XSLT_Source/Person/Address/Houseno,' '), 
                    /ns0:MT_XSLT_Source/Person/Address/Street)"/> </Street> 
                <City> <xsl:value-of select="/ns0:MT_XSLT_Source/Person/Address/City"/> </City> 
            </ns1:MT_XSLT_Target> 
        </xsl:template> 
    </xsl:stylesheet>
    For testing in PI ,change the extension from .txt to .xsl and zip it and upload into PI as an imported archive .
    Regards
    Venkat

Maybe you are looking for

  • How do I use Oracle Database Security in my HTML DB App?

    I have an existing client server application that each user has a database account. These accounts are set up currently to allow and disallow appropriate access to data via Database Rolls. I want to augment the client server application with a HTML D

  • Intro to UltraSPARC Architecture 2005

    (this posting is cross-posted in my blog, http://blogs.sun.com/roller/page/dweaver) Not only is the OpenSPARC T1 processor the first open-sourced 64-bit processor implementation, but it (and its twin, UltraSPARC T1/Niagara) are the first processors t

  • Customized Setting of External Applications are NOT saved if using templates

    We are using templates and on the template we have put the "External Application" portlet . Now if normal user tries and customize this portlet then these settings are not saved. Like user want's to see only 2 applications so he checks only 2 applica

  • Can't ssh to Oracle Database (E-business SUite 11.5.10.2)

    Hi, Time to time I've noticing server froze.Can't ssh to Oracle Database (E-business Suite). Please advice is any one has similar situation OS=RHEL 4.4 DB=10.2.0.3 Ebis=11.5.10.2

  • CS4 (student version) not activating after trial

    I bought the CS4 Student Edition thru my college but now after the trial period the original serial number does not work any more. What should I do?  I paid the full fee for the edition.  Thx.