Query joining 3 tables

I want to join 3 tables emp,dept,job
emp
cid pid dno div job open
1 1     10 A clerk     A
1 1     10 A manager     A
1 1     10 B manager     A
1 1     20 A salesman     A
1 1     30 C clerk     A
dept
cid pid dno div
1 1     10 A
1 1     10 B
1 1     20 A
1 1     20 B
1 1     30 C
jobtab
job      sal
clerk          100
manager          500
salesman      200
My required result is :
Result
cid pid dno div job     sal
1 1     10 A clerk 100
1 1     10 A manager 500
1 1     10 B manager 500
1 1     20 A salesman 200
1 1     20 B
1 1     30 C
My query is something like this :
select cid,pid,dno,div,job,sal
from emp e, dept d, jobtab j
where
(d.dno=e.dno and d.div=e.div)
and e.cid=d.cid
and e.pid=d.pid
and j.job=e.job
and e.open='A'
This query is not fully right. I need to use apprpriate join to get the records in dept table even if there is
no match in emp eg. the 20B and 30C rows.
Please modify the query to give the right one.

SQL> with emp as(
  2  select 1 as cid,1 as pid,10 as dno,'A' as div,'clerk' as job,'A' as open from dual
  3  union select 1,1,10,'A','manager','A' from dual
  4  union select 1,1,10,'B','manager','A' from dual
  5  union select 1,1,20,'A','salesman','A' from dual
  6  union select 1,1,30,'C','clerk','A' from dual),
  7  dept as(
  8  select 1 as cid,1 as pid,10 as dno,'A' as div from dual
  9  union select 1,1,10,'B' from dual
10  union select 1,1,20,'A' from dual
11  union select 1,1,20,'B' from dual
12  union select 1,1,30,'C' from dual),
13  jobtab as(
14  select 'clerk' as job,100 as sal from dual
15  union select 'manager',500 from dual
16  union select 'salesman',200 from dual)
17  select nvl(a.cid,b.cid),nvl(a.pid,b.pid),nvl(a.dno,b.dno),nvl(a.div,b.div),c.job,c.sal
18    from emp a full join dept b
19      on a.cid = b.cid and a.pid =b.pid and a.dno = b.dno and a.div = b.div
20    Left join jobtab c
21      on a.job = c.job and (a.dno,a.div) not in((20,'B'),(30,'C'))
22  order by 5,4;
NVL(A.CID,B.CID)  NVL(A.PID,B.PID)  NVL(A.DNO,B.DNO)  N  JOB             SAL
               1                 1                10  A  clerk           100
               1                 1                10  A  manager         500
               1                 1                10  B  manager         500
               1                 1                20  A  salesman        200
               1                 1                20  B  null      null
               1                 1                30  C  null      nullMessage was edited by:
Aketi Jyuuzou

Similar Messages

  • Query - join tables

    Dear all,
    I'm trying to create a query joining 2 tables: CATSDB and PROJ, because I want to visualize the project and the wbs at the same time according the working time recorded in cat2.
    But when I execute the query doesn't appear any values. But if I create a query separately, i.e, table by table, the values appears without problems.
    Please anyone can help me???
    Thanks,
    P.

    There should be Field/s that link these tables in order for you to create an infoset out of a table join.
    e.g. PA0008 and PA0007 both have the field PERNR.
    If there is no field common between the two, your query won't be extracting any data as you've experienced.
    These two tables don't have any field that is common to both of them. Table join won't be possible.

  • Can't join tables.query dependency not found "" in EUL

    hi ALL,
    i created one report in disco 3.1.38 and its' running fine but after storing it in database and then again trying to open it from database it gives me error "can't join tables."name of query folder" dependency not found "" in EUL"
    if any one has come across such problem and has solution for it ..please reply back.
    thanks in anticipation
    manish

    Manish,
    I have not run into this error before and maybe one of the oracle consultants could answer this better. But I here it goes. I would first try a refresh on the folders that the report in question is using. Is it possible that the under lining tables have changed? Do you have another copy of the same report outside of the database and does it still work?
    Christopher

  • Query/join/where/child parent table

    query/join/where/child parent table
    hello my query below is not working for my cf application can
    you help?
    thanks
    this is my previous question so i tried to do it my self.
    tcase_req.tcase_req_id is added
    tcase.case_id=tcase_req.case_id :note that this is not part of the
    inner join in the from clause. it does not depend on the rest of
    the inner join.
    the reaon for this is that i need to get
    WHERE tcase_req.case_req_typ_cd = cwc and
    tcase_req.case_req_typ_cd = cwnc
    here is the original question
    Hello ,
    I need help again on the inner join/and conditions in the
    where clause
    I have these 2 tables tcase and tcase_req where there common
    field Is the case_id.
    tcase is the parent table and the tcase_req is the child
    table.
    (1)I wanted to add this to the from clause using the inner
    join table . what do I do and where do I put it
    (2)I then need to put a condition in the where clause to
    replace
    WHERE TCASE.CASE_NBR Like '%HPOZ%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
    by
    WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
    '%CWNC%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
    Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
    is this efficient??
    thanks
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id,
    tcase_req.case_req_typ_cd
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE TCASE.CASE_NBR Like '%CWC%'and
    tcase.case_id=tcase_req.case_id
    (3)To a tcase_req
    Suffix_id are equal to = cwc and cwnc ( in the tcase_req
    table)(Suffix_id is the field that cintains the suffix cwc and cwnc
    for the tcase_req)
    also,
    this is the original query and it works fine
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE (TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE_NBR Like
    '%CWNC%')

    query/join/where/child parent table
    hello my query below is not working for my cf application can
    you help?
    thanks
    this is my previous question so i tried to do it my self.
    tcase_req.tcase_req_id is added
    tcase.case_id=tcase_req.case_id :note that this is not part of the
    inner join in the from clause. it does not depend on the rest of
    the inner join.
    the reaon for this is that i need to get
    WHERE tcase_req.case_req_typ_cd = cwc and
    tcase_req.case_req_typ_cd = cwnc
    here is the original question
    Hello ,
    I need help again on the inner join/and conditions in the
    where clause
    I have these 2 tables tcase and tcase_req where there common
    field Is the case_id.
    tcase is the parent table and the tcase_req is the child
    table.
    (1)I wanted to add this to the from clause using the inner
    join table . what do I do and where do I put it
    (2)I then need to put a condition in the where clause to
    replace
    WHERE TCASE.CASE_NBR Like '%HPOZ%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
    by
    WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
    '%CWNC%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
    Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
    is this efficient??
    thanks
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id,
    tcase_req.case_req_typ_cd
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE TCASE.CASE_NBR Like '%CWC%'and
    tcase.case_id=tcase_req.case_id
    (3)To a tcase_req
    Suffix_id are equal to = cwc and cwnc ( in the tcase_req
    table)(Suffix_id is the field that cintains the suffix cwc and cwnc
    for the tcase_req)
    also,
    this is the original query and it works fine
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE (TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE_NBR Like
    '%CWNC%')

  • SAP QUERY(SQ03/02/02) - how to join tables

    Hi MM Wizards,
    I would like to know how to join tables EINE & A017 through SAP Query?
    Thanks,
    Kaveri

    Hi Kaveri,
    A017 is a pooled table.  SAP Query does not support joins against Pooled tables.  You should stick to transparent tables if you want to use Query.
    You can do a direct read of A017, but you will just end up with a glorified SE16 display.
    You could have a programmer write some ABAP and place it into the 'extras' section in SQ02 to grab the additional data that you want, but once you have decided to enlist the aid of an ABAPer, it is better just to write a custom Z program from scratch.
    Regards,
    DB49

  • Slow Query: Join rows from table A with first match in table B

    Hi,
    I have been struggling with this for days. It is very slow:
    With table with 4.5 mio records it took over 2h.
    Records with anType 2 and 3 4 mio.
    Records with anType 1 and 4 500,000
    Different acWarehouse values: 20
    Different acIdent values: 9799
    Could this be written in any other way so that it would be faster.
    anId | acWarehouse | acIdent | anType | anQty | anTotalQuantity
    1| WarehouseA | IdentA | 1 | 100 | 100
    2| WarehouseA | IdentA | 1 | 100 | 200
    3| WarehouseA | IdentA | 1 | 100 | 300
    4| WarehouseA | IdentA | 1 | 100 | 400
    5| WarehouseA | IdentA | 2 | -100 | 100
    6| WarehouseA | IdentA | 2 | -100 | 200
    7| WarehouseA | IdentA | 2 | -100 | 300
    8| WarehouseA | IdentA | 2 | -100 | 400
    Result should be:
    anId | anEdge_Transaction_Id | anQuantity
    5| 1| 100
    6| 2 | 100
    7| 3 | 100
    8| 4 | 100
    Table definition:
    CREATE TABLE iPA_Transaction
         ANID     NUMBER(9,0) -- PRIMARY KEY
    ,     ACWAREHOUSE     VARCHAR2(30 CHAR)
    ,     ACIDENT     VARCHAR2(16 CHAR)
    ,     ANTYPE     NUMBER(1)
    ,     ANQTY     NUMBER(19,4)
    ,     ANTOTALQUANTITY NUMBER(19,4) -- RUNNING TOTAL
    ALTER TABLE iPA_Transaction ADD CONSTRAINT PK_Transaction PRIMARY KEY (anId);
    CREATE INDEX IX_Transaction_TEST4 ON iPA_Transaction(acIdent,acWarehouse,anType,anTotalQuantity);
    CREATE TYPE edge_transaction_data AS OBJECT (
         anId NUMBER(9,0)
    ,     anEdge_Transaction_Id NUMBER(9,0)
    ,     anQuantity NUMBER(19,4)
    CREATE TYPE edge_transaction AS TABLE OF edge_transaction_data;
    /Query:
         SELECT
              iPA_Transaction.anId
         ,     first_transaction.anEdge_Transaction_Id
         ,     first_transaction.anQuantity
         FROM
              iPA_Transaction
              INNER JOIN TABLE(
                   CAST(
                        MULTISET(
                             SELECT
                                  iPA_Transaction.anId
                             ,     MIN(transaction_stock.anId) KEEP (DENSE_RANK FIRST ORDER BY transaction_stock.anTotalQuantity) AS anEdge_Transaction_Id
                             ,     MIN(transaction_stock.anTotalQuantity) KEEP (DENSE_RANK FIRST ORDER BY transaction_stock.anTotalQuantity) AS anTotalQuantity
                             FROM
                                  iPA_Transaction transaction_stock
                             WHERE
                                  transaction_stock.anType IN (1,4)
                             AND transaction_stock.acIdent = iPA_Transaction.acIdent
                             AND transaction_stock.acWarehouse = iPA_Transaction.acWarehouse
                             AND transaction_stock.anTotalQuantity > (iPA_Transaction.antotalquantity + iPA_Transaction.anqty)
                        ) AS edge_transaction
              ) first_transaction ON (iPA_Transaction.anId = first_transaction.anId)
         WHERE
              iPA_Transaction.anType IN (2,3)
         ;-- EXECUTION PLAN
    PLAN_TABLE_OUTPUT
    Plan hash value: 1731335374
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 6634 | 362K| 107M (1)|357:36:32 |
    | 1 | NESTED LOOPS | | 6634 | 362K| 107M (1)|357:36:32 |
    |* 2 | TABLE ACCESS FULL | IPA_TRANSACTION | 3946K| 203M| 15004 (1)| 00:03:01 |
    |* 3 | COLLECTION ITERATOR SUBQUERY FETCH| | 1 | 2 | 27 (0)| 00:00:01 |
    | 4 | VIEW | | 1 | 39 | 6 (0)| 00:00:01 |
    | 5 | SORT AGGREGATE | | 1 | 50 | | |
    | 6 | INLIST ITERATOR | | | | | |
    | 7 | TABLE ACCESS BY INDEX ROWID | IPA_TRANSACTION | 1 | 50 | 6 (0)| 00:00:01 |
    |* 8 | INDEX RANGE SCAN | IX_TRANSACTION_TEST4 | 1 | | 5 (0)| 00:00:01 |
    Query Block Name / Object Alias (identified by operation id):
    1 - SEL$80EA2A9E
    2 - SEL$80EA2A9E / IPA_TRANSACTION@SEL$1
    3 - SEL$80EA2A9E / KOKBF$@SEL$2
    4 - SEL$4 / KOKSDML$@SEL$540AC7B0
    5 - SEL$4
    7 - SEL$4 / TRANSACTION_STOCK@SEL$4
    8 - SEL$4 / TRANSACTION_STOCK@SEL$4
    Predicate Information (identified by operation id):
    2 - filter("IPA_TRANSACTION"."ANTYPE"=2 OR "IPA_TRANSACTION"."ANTYPE"=3)
    3 - filter("IPA_TRANSACTION"."ANID"=SYS_OP_ATG(VALUE(KOKBF$),1,2,2))
    8 - access("TRANSACTION_STOCK"."ACIDENT"=:B1 AND "TRANSACTION_STOCK"."ACWAREHOUSE"=:B2 AND
    ("TRANSACTION_STOCK"."ANTYPE"=1 OR "TRANSACTION_STOCK"."ANTYPE"=4) AND
    "TRANSACTION_STOCK"."ANTOTALQUANTITY">:B3+:B4 AND "TRANSACTION_STOCK"."ANTOTALQUANTITY" IS NOT NULL)
    Column Projection Information (identified by operation id):
    1 - (#keys=0) "IPA_TRANSACTION"."ANID"[NUMBER,22],
    "IPA_TRANSACTION"."ACWAREHOUSE"[VARCHAR2,120], "IPA_TRANSACTION"."ACIDENT"[VARCHAR2,64],
    "IPA_TRANSACTION"."ANTYPE"[NUMBER,22], "IPA_TRANSACTION"."ANQTY"[NUMBER,22],
    "IPA_TRANSACTION"."ANTOTALQUANTITY"[NUMBER,22], VALUE(A0)[96]
    2 - "IPA_TRANSACTION"."ANID"[NUMBER,22], "IPA_TRANSACTION"."ACWAREHOUSE"[VARCHAR2,120],
    "IPA_TRANSACTION"."ACIDENT"[VARCHAR2,64], "IPA_TRANSACTION"."ANTYPE"[NUMBER,22],
    "IPA_TRANSACTION"."ANQTY"[NUMBER,22], "IPA_TRANSACTION"."ANTOTALQUANTITY"[NUMBER,22]
    3 - VALUE(A0)[96]
    4 - "KOKSDML$"."KOKSDML$_C00000"[NUMBER,22], "KOKSDML$"."ANEDGE_TRANSACTION_ID"[NUMBER,22],
    "KOKSDML$"."ANTOTALQUANTITY"[NUMBER,22]
    5 - (#keys=0) MIN("TRANSACTION_STOCK"."ANTOTALQUANTITY") KEEP (DENSE_RANK FIRST ORDER BY
    "TRANSACTION_STOCK"."ANTOTALQUANTITY")[22], MIN("TRANSACTION_STOCK"."ANID") KEEP (DENSE_RANK FIRST
    ORDER BY "TRANSACTION_STOCK"."ANTOTALQUANTITY")[22]
    6 - "TRANSACTION_STOCK".ROWID[ROWID,10], "TRANSACTION_STOCK"."ANID"[NUMBER,22],
    "TRANSACTION_STOCK"."ACWAREHOUSE"[VARCHAR2,120], "TRANSACTION_STOCK"."ACIDENT"[VARCHAR2,64],
    "TRANSACTION_STOCK"."ANTYPE"[NUMBER,22], "TRANSACTION_STOCK"."ANTOTALQUANTITY"[NUMBER,22]
    7 - "TRANSACTION_STOCK".ROWID[ROWID,10], "TRANSACTION_STOCK"."ANID"[NUMBER,22],
    "TRANSACTION_STOCK"."ACWAREHOUSE"[VARCHAR2,120], "TRANSACTION_STOCK"."ACIDENT"[VARCHAR2,64],
    "TRANSACTION_STOCK"."ANTYPE"[NUMBER,22], "TRANSACTION_STOCK"."ANTOTALQUANTITY"[NUMBER,22]
    8 - "TRANSACTION_STOCK".ROWID[ROWID,10], "TRANSACTION_STOCK"."ACIDENT"[VARCHAR2,64],
    "TRANSACTION_STOCK"."ACWAREHOUSE"[VARCHAR2,120], "TRANSACTION_STOCK"."ANTYPE"[NUMBER,22],
    "TRANSACTION_STOCK"."ANTOTALQUANTITY"[NUMBER,22]
    Edited by: 939464 on 08-Jun-2012 02:30
    Edited by: 939464 on 08-Jun-2012 02:32
    Edited by: 939464 on 08-Jun-2012 02:36
    Edited by: 939464 on 08-Jun-2012 04:39

    Additional to what has just been said by Hoek, which I also quote, I feel this could be a problem similar to the one posted here.
    [url:https://forums.oracle.com/forums/thread.jspa?threadID=2387388]SQL - Which positive covered the negative?
    Could you please let us know a bit more about the logic of the output?
    1) Do you want to know which transaction with positive quantity cover the current transaction with negative quantity?
    2) How does it need to be partitioned?
    3) Are the quantity always equal for corresponding transaction?
    If I just look at your data I can do something really simple but it might be not what you need.
    CREATE TABLE iPA_Transaction
    ANID NUMBER(9,0) -- PRIMARY KEY
    , ACWAREHOUSE VARCHAR2(30 CHAR)
    , ACIDENT VARCHAR2(16 CHAR)
    , ANTYPE NUMBER(1)
    , ANQTY NUMBER(19,4)
    , ANTOTALQUANTITY NUMBER(19,4) -- RUNNING TOTAL
    ALTER TABLE iPA_Transaction ADD CONSTRAINT PK_Transaction PRIMARY KEY (anId);
    CREATE INDEX IX_Transaction_TEST4 ON iPA_Transaction(acIdent,acWarehouse,anType,anTotalQuantity);
    INSERT INTO iPA_Transaction VALUES(1, 'WarehouseA', 'IdentA', 1 , 100, 100);
    INSERT INTO iPA_Transaction VALUES(2, 'WarehouseA', 'IdentA', 1 , 100, 200);
    INSERT INTO iPA_Transaction VALUES(3, 'WarehouseA', 'IdentA', 1 , 100, 300);
    INSERT INTO iPA_Transaction VALUES(4, 'WarehouseA', 'IdentA', 1 , 100, 400);
    INSERT INTO iPA_Transaction VALUES(5, 'WarehouseA', 'IdentA', 2 , -100, 100);
    INSERT INTO iPA_Transaction VALUES(6, 'WarehouseA', 'IdentA', 2 , -100, 200);
    INSERT INTO iPA_Transaction VALUES(7, 'WarehouseA', 'IdentA', 2 , -100, 300);
    INSERT INTO iPA_Transaction VALUES(8, 'WarehouseA', 'IdentA', 2 , -100, 400);
    SELECT a.anid, b.anid anedge_transaction_id, -a.anqty anqty
      FROM ipa_transaction a, ipa_transaction b
    WHERE     a.acwarehouse = b.acwarehouse
           AND a.acident = b.acident
           AND a.antype IN (2, 4)
           AND b.antype IN (1, 4)
           AND a.antotalquantity = b.antotalquantity;
          ANID ANEDGE_TRANSACTION_ID      ANQTY
             5                     1        100
             6                     2        100
             7                     3        100
             8                     4        100
    {code}
    Try to give additional details.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • What is the better way to join table for ASE 12.5?

    To join table with T-SQL, there are 2 options:
    select * from tab1 a join tab2 b on a.id = b.id where x=y
    select * from tab1a, tab2 b where a.id = b.id and x=y
    this is only a syntax difference or there is a performance difference? which one is better for performance?

    The first query (using the join clause) is the ANSI standard way of writing joins and is usually supported by all mainstream RDBMSs.
    The second query is the T-SQL method of writing joins and may have limited re-usability with other RDBMSs.
    In most cases which one you use is usually one of preference, ie, which ever one you're comfortable with.
    From a technical perspective there are some join constructs that you cannot build with T-SQL joins, but can build with ANSI joins (eg, you may have problems in T-SQL with a table that you want to be both a) an inner table of an outer join and b) part of a equi/inner join).
    Soooo, ANSI joins provide you a lot more flexibility in coding as well as portability (between other RDBMSs).  But if you're going to work with ASE you'll still need to understand how T-SQL joins work as you'll see quite a lot of T-SQL join-based queries.

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • Limit on Joined Tables or DB Links Used in a single Select Statement???

    I am writing a query that joins upwards of five tables utilizing two or three DB links in the process. When I run the query I get an error telling me that the table or view does not exist. I know that it does in fact exist and I am able to run a separate query on said table even across a DB Link. I've never know there to be a limit to the amount of DB Links used within a single query, but then again, I previously have only written in T-SQL.
    I am using ANSI standard SQL in my joins syntax and am familial with the syntax for use of remote DB tables in PL/SQL.
    Does anyone have an idea what the problem might be?
    David

    I am Using Oracle 10g and I'm positive that I am not exceeding my OPEN_LINKS limit.
    As far as my SQL, here is a simplified version:
    SELECT count(*)
    FROM SYSADM.PS_PERSONAL_DATA
    INNER JOIN ARTEMIS.HRMS_EMPLOYMENT_TBL@prod ON ARTEMIS.HRMS_EMPLOYMENT_TBL.EMPLOYEE_ID = SYSADM.PS_PERSONAL_DATA.EMPLID
    INNER JOIN ARTEMIS.HRMS_JOB_TBL@prod on ARTEMIS.HRMS_JOB_TBL.EMPLOYEE_ID = ARTEMIS.HRMS_EMPLOYMENT_TBL.EMPLOYEE_ID
    INNER JOIN SYSADM.PS_DEPT_TBL on ARTEMIS.HRMS_JOB_TBL.JOB_DEPT_ID = SYSADM.PS_DEPT_TBL.DEPTID
    INNER JOIN UMSSECU.PERSON@sirs ON ARTEMIS.HRMS_JOB_TBL.EMPLOYEE_ID = UMSSECU.PERSON.PERSON_ID
    INNER JOIN UMSSECU.ASSIGNMENT@sirs ON UMSSECU.PERSON.PERSON_ID = UMSSECU.ASSIGNMENT.PERSON_ID
    INNER JOIN UMSSECU.ORGANIZATION@sirs ON UMSSECU.ASSIGNMENT.ORGANIZATION_ID = UMSSECU.ORGANIZATION.ORGANIZATION_ID;
    The error comes into play with the join to UMSSECU.ASSIGNMENT@sirs it says that the table does not exist. But when I run (select count(*) from UMSSECU.ASSIGNMENT@sirs) on the sirs DB it executes without error. I am confused. I also just identified that I cannot remotely query that table in particular. All the other tables from the sirs DB can be queried from the other DB.

  • Problem with ORA-19025 when joining tables

    I am querying a table that stores xml datata in an xml column. I an query this column without problems. If I join the table with another table (not xml). I get the error below.
    ORA-19025: EXTRACTVALUE returns value of only one node
    19025. 00000 - "EXTRACTVALUE returns value of only one node"
    *Cause:    Given XPath points to more than one node.
    *Action:   Rewrite the query so that exactly one node is returned.
    I don't seem to have any subnodes in the fields I am querying and I dont know how joining to the second table introduces the problem.
    This produces the error I mentioned before
    SELECT a.NAME,
    EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/title') TITLE,
    EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/origin') ORIGIN,
    EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/pubdate') PUBLICATION_DATE,
    GDB_ITEMTYPES.NAME
    FROM GDB_ITEMS_vw a, GDB_ITEMTYPES b
    where a.UUID = b.UUID
    This one gives no error
    SELECT a.NAME,
    EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/title') TITLE,
    EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/origin') ORIGIN,
    EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/pubdate') PUBLICATION_DATE,
    FROM GDB_ITEMS_vw a
    I am using 11g 2
    Any suggestions are welcome
    Thanks
    Edited by: user3444035 on Mar 18, 2011 1:43 PM

    Hi,
    Could you give some sample data from GDB_ITEMS_vw and GDB_ITEMTYPES?

  • Joining table in GRC 10 Process Control

    Hi,
    I am trying to create a new Data Source in GRC 10 Process Control. I need to join tables AGR_1251 (main table) and AGR_USERS. I am selecting AGR_1251 as main table. However, nothing comes up when I try to select AGR_USERS as 'Related Table'. On searching AGR_USERS , the system does not return any tables. Both are transparent tables and hence can be joined. I tried using both 'Reference Tables' as well as 'Dependent Tables' .
    Can you also explain the difference between 'Reference Tables' and 'Dependent Tables'.
    Regards,

    Hi Amarnath,
    tables is used to provide the table for the CURR(currency) or QUAN (quantity) fields.
    In your case you want to join tables via foreign key(s) and therefore will have to use dependant tables.
    The search for table AGR_USERS as dependant table for AGR_1251 will not return anything since the only table
    referred as check table (for a foreign key) in AGR_1251 is AGR_DEFINES.
    I would suggest to build your query based on defined check tables (see se11) of the needed tables (in this case AGR_DEFINE is the common point of both AGR_USERS & AGR_1251).
    Kind regards,
    Pascal

  • DB connectivi​ty toolkit: syntax error in a SELECT data from joined tables

    Hello everyone
    I'm trying to put in labview an SQL query on joined tables.
    As example I take a DB for storing the data of 2on2 basketball games, whose tables are
    matches(matchId,teamA,teamB)
    teams(teamId,PlayerAname,PlayerBname,Nationality)
    nationalities(NatId,natName)
    To get a result table with the match number and the player names along with their nationality I use this query on MySQL (which works on the command line interface)
    SELECT MatchID,
                     t1.PlayerAName, t1.PlayerBName, n1.natName,
                     t2.PlayerAName, t2.PlayerBName, n2.natName
    FROM matches m
    INNER JOIN teams t1 ON t1.teamID = m.teamA
    INNER JOIN teams t2 ON t2.teamID = m.teamB
    INNER JOIN nationalities n1 ON n1.natID = t1.nationality
    INNER JOIN nationalities n2 ON n2.natID = t2.nationality
    When I put it in labview, using the "select data" block, I get a syntax error as shown in the attached screenshot.
    Am I mistanking something in using the JOIN statements, or the aliases?
    Thanks in advance!
    Solved!
    Go to Solution.
    Attachments:
    select2dabone.vi ‏12 KB

    Giovasa wrote:
    I do't like very much the chain of blocks execute query+n*(fetch element)+free object, so I try to avoid that as much that I can...
    Sounds like a prime candidate for a subVI. You don't have to use it every time, but it probably would help for cases where you do want to put the SQL query directly in code.
    Incidentally, if you're doing joins, you might consider using views, as that allows you to hide the details of the interactions of the tables in the DB itself.
    Try to take over the world!

  • Select distinct problem with muliple join tables, help needed

    Hi,
    I have two main tables. Each has its of sub joined tables.
    guest_id_for_reservation connects two major tables. This has
    to be that way
    because my guest may change the room status from single to
    double (and the
    similar exceptional requests).
    guests reservation
    guest_id_for_reservation
    countrytable hoteltable
    delegationtable roomtype
    I form a query. I want to select distinct those results. But
    it does not
    work.
    If I do not include any table related to reservation table
    and its sub
    joined tables (disregarding guest_id_for_reservation), it
    works.
    Is there a specific syntax for select distinct of this type
    or any
    workaround.?
    Thank you
    Hakan

    Hi I'm still battling with this - have connected the AX to my Imac via ethernet and it shows up fine in Airport Utility. Status light is green and it says its set up to connect to my existing wireless network using wireless connection. Security in Network Preferences is the same for both: WPA2 Personal.
    So I don't think there's a problem with the AX, and my current wireless network (BT Home Hub) is working fine.
    And when I restore factory settings Airport Utility can see the AX before updating settings so the wireless side of AX must work too.
    I'm figuring it must be something about the settings that mean AU can't see it anymore. But I can't work out what, since security is the same.
    Any ideas would be great!

  • Strange explain plan when query SYS tables

    Oracle Version 9.2.0.7
    We have an application that runs the following query on Oracle 9.2.0.7
    SELECT T1.TABLE_NAME,T1.COLUMN_NAME, T1.SRID, T2.SDO_UB, T2.SDO_LB, T1.OWNER FROM ALL_SDO_GEOM_METADATA T1, TABLE(T1.DIMINFO) T2 WHERE T1.OWNER=UPPER(:"SYS_B_0") AND T1.TABLE_NAME=UPPER(:"SYS_B_1")
    Without the self join the query is fine, but with the self join on our customers database the explain plan is doing full table scans and Hash Joins on SYS tables and takes 2 minutes.
    Rows Row Source Operation
    2 FILTER
    2 NESTED LOOPS
    1 TABLE ACCESS FULL SDO_GEOM_METADATA_TABLE
    2 COLLECTION ITERATOR PICKLER FETCH
    1 UNION-ALL
    0 FILTER
    0 NESTED LOOPS OUTER
    0 HASH JOIN
    37 TABLE ACCESS FULL TS$
    0 HASH JOIN OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS FULL USER$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    0 FILTER
    0 NESTED LOOPS OUTER
    0 HASH JOIN
    54 TABLE ACCESS FULL USER$
    0 HASH JOIN
    29447 TABLE ACCESS FULL OBJ$
    0 HASH JOIN OUTER
    0 HASH JOIN OUTER
    0 HASH JOIN OUTER
    0 NESTED LOOPS
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS CLUSTER TS$
    0 INDEX UNIQUE SCAN I_TS# (object id 7)
    0 TABLE ACCESS CLUSTER COL$
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER COLTYPE$
    0 TABLE ACCESS FULL USER$
    0 TABLE ACCESS FULL OBJ$
    0 TABLE ACCESS FULL USER$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    1 FILTER
    1 NESTED LOOPS
    1 NESTED LOOPS OUTER
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 INDEX UNIQUE SCAN I_TYPED_VIEW1 (object id 105)
    1 INDEX UNIQUE SCAN I_VIEW1 (object id 104)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    On our development database it takes 0.07 sec with no full table scans and no hash joins.
    Rows Row Source Operation
    2 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID SDO_GEOM_METADATA_TABLE
    1 INDEX RANGE SCAN SDO_GEOM_IDX (object id 36753)
    1 UNION-ALL
    0 FILTER
    0 NESTED LOOPS
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS CLUSTER TS$
    0 INDEX UNIQUE SCAN I_TS# (object id 7)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    0 FILTER
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS CLUSTER TS$
    0 INDEX UNIQUE SCAN I_TS# (object id 7)
    0 TABLE ACCESS CLUSTER COL$
    0 TABLE ACCESS CLUSTER COLTYPE$
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX RANGE SCAN I_OBJ3 (object id 38)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    1 FILTER
    1 NESTED LOOPS
    1 NESTED LOOPS OUTER
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 INDEX UNIQUE SCAN I_TYPED_VIEW1 (object id 105)
    1 INDEX UNIQUE SCAN I_VIEW1 (object id 104)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    2 COLLECTION ITERATOR PICKLER FETCH
    ALL_SDO_GEOM_METADATA is a view in the MDSYS schema (generated by Oracle ).
    SELECT SDO_OWNER OWNER,
    SDO_TABLE_NAME TABLE_NAME,
    SDO_COLUMN_NAME COLUMN_NAME,
    SDO_DIMINFO DIMINFO,
    SDO_SRID SRID
    FROM SDO_GEOM_METADATA_TABLE
    WHERE
    (exists
    (select table_name from all_tables
    where table_name=sdo_table_name
    and owner = sdo_owner
    union all
    select table_name from all_object_tables
    where table_name=sdo_table_name
    and owner = sdo_owner
    union all
    select view_name table_name from all_views
    where view_name=sdo_table_name
    and owner = sdo_owner))
    Statistics have been gathered for the MDSYS user.
    If this had not been SYS schema I would have immediately concluded that fresh statistics are required. The SYS objects concerend are valid with all indexes
    From my understanding you are not meant to gather stats for the SYS schema in Oracle 9 as Data Dictionary queries still uses RBO?
    Any ideas as to why Oracle is doing full table scans when querying SYS tables? The optimizer_mode is set to FIRST_ROWS.
    Any ideas greatly recevied.
    Thanks

    Maybe I'm missing something but this:
    INDEX FULL SCAN     SISESTAT     I0_ESTRUTURA_COMERCIALindicates that one of those indexes is being used.
    This:
    T_ESTRUTURA_COMERCIALIs nowhere to be found in your Explain Plan. It appears that either you have posted the wrong plan
    or Oracle is doing a query rewrite to a materialized view.

  • Right order of joining tables

    Hi everybody,
    I have read the SQL Tuning section of Performance Tuning Oracle Book of Oracle 10g. v.2.
    In 11.5.4. paragraph titled "Controlling the Access Path and Join Order with Hints" , in the second note there is a small paragraph about the right join of the tables....
    In whichever query i try ,i've noticed that altering the joining order of the tables the sql statistics (consistent gets , sorts(memory/disk)) are the same regardless of the join order....
    Can you please give me an example or a source in which the modification of the join order of the tables in a sql query produce different results ...in statistics????
    Thanks , a lot
    Simon

    Duplicate post. Don't answer this thread please Right order of joining tables.
    Cheers, APC

  • Query/join problem

    Does anyone see any issues in my query/join?
    Select c.case_id, a.business_unit, a.field_name, a.change_date, a.old_value, a.new_value, a.created_by, a.creation_date, c.provider_group_id, c.creation_date, c.closed_dttm
    From ps_case c, ps_case_history_audit a
    where
    a.case_id = c.case_id and
    a.field_name = 'case_status' and
    a.new_value = 'Open - Dispatch' and
    a.created_by like '%tag%' and
    c.provider_group_id like '%tag%' and
    c.closed_dttm between '03-NOV-2013' and '10-NOV-2013'
    SQL Dev: All Rows Fetched: 0   But it should be returning something with the stated parameters.

    Hi,
    I'm willing to share what I know about SQL to help solve this problem.  Are you willing to share what you know about the data and the application?
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you expect from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002
    "0 rows found" is sometimes the correct answer.  Why do you think it's not in this case?
    If c.closed_dttm is a DATE (or a TIMESTAMP) then you shouldn't be comparing it to strings, as in
    c.closed_dttm between '03-NOV-2013' and '10-NOV-2013'
    However, that would probably produce too many rows in this case, not too few.
    At any rate, compare DATEs to other DATEs, for example
    c.closed_dttm between TO_DATE ('03-NOV-2013', 'DD-MON-YYYY') and ...
    If this isn't the cause of today's problem today, it will be tomorrow's.

Maybe you are looking for

  • External Drive for itunes library.

    Hello, I was just hoping that someone could answer what is probably a very silly question. I currently use my ibook as a working computer and itunes library. This is causing problems now as i'm running out of disk space. Is it possible to buy an exte

  • Users new iPhone 6 is stripping attachments

    Good morning, I have a user who is trying to load an RSA token onto her new iPhone 6 and when it is sent to her via Exchange e-mail her phone appears to be stripping the .sdtid attachment. She is able to see the attachment in the desktop version of O

  • ISE 1.2 Patch 6 Bulk account creation Sponsor portal bug

    Hi all, not sure whether anyone has this issue but I noticed yesterday when I do a bulk csv import of users into the sponsor portal that it does not hold the user group I specifiy. In summary I select my CSV file, choose my user type as contractor (g

  • [SOLVED] Wireless connect with username and password

    I just recently installed Arch on my computer but have used *buntu for a couple of years so I'm not completely lost in the Linux-world. Anyway, my college have a wireless setup that requires you to log in with your username and password. I used wicd

  • WebService Proxy and x509 cert. authentication

    Does anybody know if JDeveloper 10.1.3 generated WebService proxy by default is trying to use wallet other then keystore? We have generated a web service proxy and trying to make a call to a WebService over SSL to the site which require x509 certific