TT6.0.4 delete with subquery?

Hi,
afaik subqueries are allowed in select statements.
my environment:
TimesTen Release 6.0.4 (64 bit Solaris) (tt60_64:16001) Jul 8 2006 12:14:43
with oracle 10g cache.
Statement:
Command> SELECT * FROM X.T1 WHERE NOT EXISTS (SELECT 1 FROM X.T2 WHERE X.T2.Id = X.T1.Id);
0 rows found.
This is ok.
Command> DELETE FROM X.T1 WHERE NOT EXISTS (SELECT 1 FROM X.T2 WHERE X.T2.Id = X.T1.Id);
2206: Table X.T2 not found
The command failed.
Any idea?
Thx!

That explains it then. For any single SQL statement, it will either execute completely in Timesten (Passthrough = 0 - table T2 not found) or completely in Oracle (Passthrough = 1, 2 or 3 - query executed in Oracle successfully).
Chris

Similar Messages

  • Adobe XMP Files not deleted with Raw Files in ACR

    I am using Photoshop CS3 on a Windows XP platform. My camera raw files are mostly kept on a Windows 2003 file server, which has a gigabit connection to my workstation. However, I have the same problems when using PS CS3 on my Windows XP laptop.
    I take many hundreds of 'technical' photographs using an Olympus E1 and Canon G9 cameras. I usually bracket the exposures on the E1, specially when photographing white painted yachts, and then rate and select the images that I want in ACR 4.1.1. Unwanted images are deleted at this time.
    The problem I am having is that the associated *.xmp files are not always deleted with the camera raw files, with the result that I now have literally thousands of these 'orphaned' files cluttering up the server. The only options I have are to delete the files manually, which is a pain, or to leave them on the server, wasting unnecessary space.
    I have the same issue with Canon and Nikon raw files, so this problem is not specific to Olympus files.
    This is a long standing problem, and I would be grateful if anyone has any answers?
    If any Adobe programmers are watching, it would be handy if you could provide a simple utility to delete orphaned *.xmp files, or at least compress them into some kind of archive.
    Thanks,
    Nigel.

    [quote] As far as Photoshop and ACR go, ALL raw files are treated as read-only.
    Your original raw files remain untouched, no matter what you do to them.
    Any adjustments you make to a raw file are kept only as metadata (flags, if you will) in that XMP side-car file. Every time you want to re-open that raw image file, ACR will reach for the XMP file and apply the adjustments automatically, transparently. [/quote]
    That is not quite correct. Camera RAW files can be permanently deleted from within Adobe Camera Raw. The problem with ACR 4.1 to 4.4 4 was that the XMP files were left behind. This now seems to have been rectified in the latest version (ACR 4.5).
    Thank you Adobe!

  • Query with subquery should return value but doesn't

    When I run this SQL, it returns no value:
    SELECT vfn.cat
    FROM vps_fishery_ner vfn, valid_fishery vf
    WHERE vfn.plan = vf.plan
    AND vfn.cat = vf.cat
    AND vf.permit_year = 2010
    AND vf.moratorium_fishery = 'T'
    AND vfn.vp_num = 211652
    AND vfn.ap_year = 2010
    AND vfn.plan = 'MUL'
    AND vfn.date_issued = (SELECT MAX(date_issued)
    FROM vps_fishery_ner
    WHERE vp_num = 211652
    AND ap_year = 2010);
    In order to test, I take out the subquery and run it separately:
    SELECT MAX(date_issued)
    FROM vps_fishery_ner
    WHERE vp_num = 211652
    AND ap_year = 2010;
    Returns 02-APR-10
    Then I paste this date into the original query (using the TRUNC function, of course, since I hardcode only the DDMMYY part of the date):
    SELECT vfn.cat
    FROM vps_fishery_ner vfn, valid_fishery vf
    WHERE vfn.plan = vf.plan
    AND vfn.cat = vf.cat
    AND vf.permit_year = 2010
    AND vf.moratorium_fishery = 'T'
    AND vfn.vp_num = 211652
    AND vfn.ap_year = 2010
    AND vfn.plan = 'MUL'
    AND TRUNC(date_issued) = TO_DATE('02-APR-10');
    And this returns the required value, 'A'.
    So why doesn't the full query with subquery work, if the value that is returned by the subquery is valid and works when you just paste it in?
    Thanks.

    Hi,
    Not sure about your question.
    But you say when you uss 01-apr-10 you get the expected results.
    So why dont you try using trunc on botht sides
    SELECT vfn.cat
      FROM vps_fishery_ner vfn, valid_fishery vf
    WHERE vfn.plan = vf.plan
       AND vfn.cat = vf.cat
       AND vf.permit_year = 2010
       AND vf.moratorium_fishery = 'T'
       AND vfn.vp_num = 211652
       AND vfn.ap_year = 2010
       AND vfn.plan = 'MUL'
       AND trunc(vfn.date_issued) = (SELECT MAX(trunc(date_issued))
                                FROM vps_fishery_ner
                               WHERE vp_num = 211652
                                 AND ap_year = 2010);Rememeber if you are couting on some Index to be used you might want to recheck.
    IN answer to your question why it does not return with subquery included, because the TIME PART is not the same.
    You yourself proved it by using the supplying only the date part.
    Regards,
    Bhushan

  • TS1702 i have erased my all phone contact list and then the message comes that it will be deleted with in an hour. but now my phone is not starting and only the apple logo appears on the screen. what should i do now..!

    i have erased my all phone contact list and then the message comes that it will be deleted with in an hour. but now my phone is not starting and only the apple logo appears on the screen. what should i do now..!

    That number is for an apple server in the UK that is used for iMessage activation.  A hidden SMS is snet to that number when you turn iMessage on and is used to verify your phone number.  I suggest you turn iMessage off.  In settings/phone turn on dial assist.  Check with your carrier to see if you can send an international SMS as you end that possibility to activate iMessage.  Rest your phone (Hold down the Sleep/Wake button and the home button together until the apple logo appears (ignore the ON/OFF slider) then let both buttons go and wait for device to restart (no data will be lost).) then turn iMessage back on.

  • Is there any way to fwd delete with mavericks?

    Is there any way to fwd delete with mavericks?

    Try Fn+Delete if you are asking about deleting characters to the right of typed text. Verified on TextEdit.

  • Update column with subquery returning more than one row

    Hi Everybody,
    Please let me know how to handle this. I am writing update statement in procedure with subquery and it is returning multiple rows. Please help me, how i can handle this :
    UPDATE TABLEA A
    SET A.ERROR_MESSAGE = (Select B.XERROR_MESSAGE from TABLEB B, TABLEA A WHERE B.id = A.id)
    WHERE A.id = (Select B.id from TABLEB B, TABLEA A WHERE B.id = A.id);
    (Select B.XERROR_MESSAGE from TABLEB B, TABLEA A WHERE B.id = A.id) --- This subquery is returning more than one rows. How i can handle this in Pl/SQL?
    Please let me know. I will be very thankful to you all.
    I will really appreciate your replies and comments.
    Thank you

    Try getting rid of tablea in your subqueries. You already have it in the UPDATE statement.
    UPDATE TABLEA A
    SET    A.ERROR_MESSAGE = (Select B.XERROR_MESSAGE
                              from   TABLEB B
                              WHERE  B.id = A.id
    WHERE  A.id = (Select B.id
                   from   TABLEB B
                   WHERE  B.id = A.id);You can also try a simple MERGE:
    merge into tablea a
    using tableb b
    on    (a.id = b.id)
    when  matched then update
          set a.error_message = b.xerror_message;

  • DB polling : query with subquery

    Hi,
    We are upgrading the 10g code to 11g, where one process has the DB polling with custom SQQL. This SQL has a subquery like,
    Select Name, ID, CID from tabl1 where lastdate + (select num_value from table2 where column2 = "xxx") <= sysdate
    We want the similar functionality in 11g. The upgraded code generated few artifiacts like toplink. We have bulilt that and deployed to server. But it is not polling the data eventhough the matching records are present in the tables.
    Please let us know how to fix this issue.
    Thanks,
    Vinoth

    Hi,
    Not sure about your question.
    But you say when you uss 01-apr-10 you get the expected results.
    So why dont you try using trunc on botht sides
    SELECT vfn.cat
      FROM vps_fishery_ner vfn, valid_fishery vf
    WHERE vfn.plan = vf.plan
       AND vfn.cat = vf.cat
       AND vf.permit_year = 2010
       AND vf.moratorium_fishery = 'T'
       AND vfn.vp_num = 211652
       AND vfn.ap_year = 2010
       AND vfn.plan = 'MUL'
       AND trunc(vfn.date_issued) = (SELECT MAX(trunc(date_issued))
                                FROM vps_fishery_ner
                               WHERE vp_num = 211652
                                 AND ap_year = 2010);Rememeber if you are couting on some Index to be used you might want to recheck.
    IN answer to your question why it does not return with subquery included, because the TIME PART is not the same.
    You yourself proved it by using the supplying only the date part.
    Regards,
    Bhushan

  • Delete with IN and EXISTS

    Hi,
    I was suggested by one of the oracle forums member
    that
    DELETE FROM PYMT_DTL WHERE CLM_CASE_NO IN
    (SELECT CLM_CASE_NO FROM TEMP_ARCHIVE1 );
    is same as
    DELETE FROM PYMT_DTL WHERE EXISTS (SELECT CLM_CASE_NO FROM TEMP_ARCHIVE1);
    I see rows only get deleted with 2nd query
    if both queries are same why is not 1st query deleteing rows ?
    Thanks in Advance

    Hi,
    The two DELETE statements you posted are not the same.
    DELETE  FROM PYMT_DTL
    WHERE  EXISTS
            ( SELECT CLM_CASE_NO
              FROM TEMP_ARCHIVE1
            );will see if there is anything at all in the temp_archive1 table. If so, it will delete every row in pymt_dtl. If not, nothing will be deleted.
    If you want to delete rows from pymt_dtl that have a matching row in temp_archive1, then you can use the first DELETE statement you posted, or this:
    DELETE  FROM pymt_dtl  m
    WHERE   EXISTS
            SELECT  0
            FROM    temp_archive1
            WHERE   clm_case_no = m.clm_case_no
            );

  • Case statement with Subquery

    Case statement with Subquery
    select case when condition then
    i want to execute qr1
    else qr2
    How to implement this ?

    Hi,
    Welcoem to the forum!
    972471 wrote:
    Case statement with SubqueryHow does a sub-query, or a query, figure in this question?
    Be more specific. Post a complete script that you tried, and what output you expected from it. If you got an error, post the complete error message, including line numbers.
    See the forum FAQ {message:id=9360002}
    select case when condition then
    i want to execute qr1
    else qr2
    How to implement this ?Here's one way:
    BEGIN
        CASE
            WHEN  1 = 1
            THEN
                dbms_output.put_line ('Condition was TRUE');
            ELSE
                dbms_output.put_line ('Condition was FALSE or UNKNOWN');
        END CASE;
    END;
    /If the condition involves a query, then you may have to select the results into a variable first, and then use the variable in the CASE statement.

  • Performance of reports with subquery

    I am experiencing a performance issue for those reports with subquery. Is there anything I could do to get a better performance in terms of fine tuning my report. such as capturing result (client list) in a filter first instead of using a subquery.
    I'm open to any suggestions.
    Thanks,
    Ted

    Thank you for your suggestion.
    Is there anything I could do on OBIEE side? such as run the subquery first and get it cached before running the main report?
    Subquery would return around 5,000 clients. I use it to subset clients which are not in the subquery.
    Thanks,
    Ted

  • Slow connect by prior ... start with subquery in 9i

    Has anyone come across a performance problem (compared to 8i) when using hierarchical queries where the START WITH list is generated by a subquery? The culprit seems to be an extra visit to the subquery block as part of the CONNECT BY WITH FILTERING operation.
    For example, take a simple tree structure:
    CREATE TABLE tree
    id NUMBER,
    parentid NUMBER
    CONSTRAINT tree_pk PRIMARY KEY (id)
    ...and a subquery - here just a table called sample with a subset of the ids from the tree table:
    CREATE TABLE sample
    id NUMBER,
    CONSTRAINT sample_pk PRIMARY KEY (id)
    ...with which to drive the start points of the treewalk:
    SELECT parentid, id, label
    FROM tree
    CONNECT BY PRIOR parentid = id
    START WITH id IN
    SELECT id FROM SAMPLE
    With the tables populated and analyzed, I get this from 8i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY
    .2....1.....NESTED LOOPS (Cost=1 Card=1280 Bytes=10240)
    .3....2.......INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=1 Card=1280 Bytes=5120)
    .4....2.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .5....1.....TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .6....1.....TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    .7....6.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=1)
    Statistics
    .....0..recursive calls
    .....4..db block gets
    .15687..consistent gets
    ....59..physical reads
    .....0..redo size
    223313..bytes sent via SQL*Net to client
    .38276..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....3..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    and this is 9i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY (WITH FILTERING)
    .2....1.....NESTED LOOPS
    .3....2.......NESTED LOOPS (Cost=2 Card=1280 Bytes=10240)
    .4....3.........INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=2 Card=1280 Bytes=5120)
    .5....3.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .6....2.......TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .7....1.....NESTED LOOPS
    .8....7.......BUFFER (SORT)
    .9....8.........CONNECT BY PUMP
    10....7.......TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    11...10.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=20480)
    12....1.....INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (UNIQUE) (Cost=1 Card=1 Bytes=4)
    Statistics
    .....1..recursive calls
    .....1..db block gets
    .20525..consistent gets
    ....72..physical reads
    ...120..redo size
    224681..bytes sent via SQL*Net to client
    .38281..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....9..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    ..so, about another 5000 logical reads, corresponding to the extra access of the sample table at the bottom of the query plan. So instead of just visiting the START WITH subquery once, to kick off the treewalk, I seem to be revisiting it for every row returned. Not too bad if that happens to be a unique index scan as here but that's not always the case.
    I know I've got new options for re-writing this as a join under 9i, I'm just curious about those extra lookups and why they're necessary.
    Cheers - Andrew

    There is undocumented parameter in Oracle 9i "_old_connect_by_enabled"
    which controls the behavoiur of hierarchy queries in 9i and above:
    You can try to return to 8i behaviour using it:
    SQL> SELECT parentid, id
      2  FROM tree
      3  CONNECT BY PRIOR parentid = id
      4  START WITH id IN
      5  (
      6  SELECT id FROM SAMPLE
      7  )
      8  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=26)
       1    0   CONNECT BY (WITH FILTERING)
       2    1     TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE)
       3    2       NESTED LOOPS (Cost=2 Card=1 Bytes=26)
       4    3         TABLE ACCESS (FULL) OF 'SAMPLE' (TABLE) (Cost=2 Card
              =1 Bytes=13)
       5    3         INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (C
              ost=0 Card=1 Bytes=13)
       6    1     NESTED LOOPS
       7    6       BUFFER (SORT)
       8    7         CONNECT BY PUMP
       9    6       TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE) (Cost=
              1 Card=1 Bytes=26)
      10    9         INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (C
              ost=1 Card=1)
      11    1     TABLE ACCESS (FULL) OF 'TREE' (TABLE) (Cost=1 Card=1 Byt
              es=26)
      12    1     INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (INDEX (UNIQUE)) (Cos
              t=1 Card=1 Bytes=13)
    SQL> alter session set "_old_connect_by_enabled" = TRUE;
    Session altered.
    SQL> SELECT parentid, id
      2  FROM tree
      3  CONNECT BY PRIOR parentid = id
      4  START WITH id IN
      5  (
      6  SELECT id FROM SAMPLE
      7  )
      8  /
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=26)
       1    0   CONNECT BY
       2    1     NESTED LOOPS (Cost=2 Card=1 Bytes=26)
       3    2       TABLE ACCESS (FULL) OF 'SAMPLE' (TABLE) (Cost=2 Card=1
               Bytes=13)
       4    2       INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (Cos
              t=0 Card=1 Bytes=13)
       5    1     TABLE ACCESS (BY USER ROWID) OF 'TREE' (TABLE)
       6    1     TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (TABLE) (Cost=1
              Card=1 Bytes=26)
       7    6       INDEX (UNIQUE SCAN) OF 'TREE_PK' (INDEX (UNIQUE)) (Cos
              t=1 Card=1)
    Rgds.

  • Slow connect by ... start with subquery in 9i

    Has anyone come across a performance problem (compared to 8i) when using hierarchical queries where the START WITH list is generated by a subquery? The culprit seems to be an extra visit to the subquery block as part of the CONNECT BY WITH FILTERING operation.
    For example, take a simple tree structure:
    CREATE TABLE tree
    id NUMBER,
    parentid NUMBER
    CONSTRAINT tree_pk PRIMARY KEY (id)
    ...and a subquery - here just a table called sample with a subset of the ids from the tree table:
    CREATE TABLE sample
    id NUMBER,
    CONSTRAINT sample_pk PRIMARY KEY (id)
    ...with which to drive the start points of the treewalk:
    SELECT parentid, id, label
    FROM tree
    CONNECT BY PRIOR parentid = id
    START WITH id IN
    SELECT id FROM SAMPLE
    With the tables populated and analyzed, I get this from 8i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY
    .2....1.....NESTED LOOPS (Cost=1 Card=1280 Bytes=10240)
    .3....2.......INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=1 Card=1280 Bytes=5120)
    .4....2.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .5....1.....TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .6....1.....TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    .7....6.......INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=1)
    Statistics
    .....0..recursive calls
    .....4..db block gets
    .15687..consistent gets
    ....59..physical reads
    .....0..redo size
    223313..bytes sent via SQL*Net to client
    .38276..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....3..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    and this is 9i:
    Execution Plan
    .0......SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=19)
    .1....0...CONNECT BY (WITH FILTERING)
    .2....1.....NESTED LOOPS
    .3....2.......NESTED LOOPS (Cost=2 Card=1280 Bytes=10240)
    .4....3.........INDEX (FAST FULL SCAN) OF 'ID_PK' (UNIQUE) (Cost=2 Card=1280 Bytes=5120)
    .5....3.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE)
    .6....2.......TABLE ACCESS (BY USER ROWID) OF 'TREE'
    .7....1.....NESTED LOOPS
    .8....7.......BUFFER (SORT)
    .9....8.........CONNECT BY PUMP
    10....7.......TABLE ACCESS (BY INDEX ROWID) OF 'TREE' (Cost=2 Card=1 Bytes=19)
    11...10.........INDEX (UNIQUE SCAN) OF 'TREE_PK' (UNIQUE) (Cost=1 Card=20480)
    12....1.....INDEX (UNIQUE SCAN) OF 'SAMPLE_PK' (UNIQUE) (Cost=1 Card=1 Bytes=4)
    Statistics
    .....1..recursive calls
    .....1..db block gets
    .20525..consistent gets
    ....72..physical reads
    ...120..redo size
    224681..bytes sent via SQL*Net to client
    .38281..bytes received via SQL*Net from client
    ...343..SQL*Net roundtrips to/from client
    .....9..sorts (memory)
    .....0..sorts (disk)
    ..5120..rows processed
    ..so, about another 5000 logical reads, corresponding to the extra access of the sample table at the bottom of the query plan. So instead of just visiting the START WITH subquery once, to kick off the treewalk, I seem to be revisiting it for every row returned. Not too bad if that happens to be a unique index scan as here but that's not always the case.
    I know I've got new options for re-writing this as a join under 9i, I'm just curious about those extra lookups and why they're necessary.
    Cheers - Andrew

    Hi Andrew,
    Just noticed you message. I have exact same performance problem. It's just killing ant other processes and runs forever.
    Could you please share you experience how to deal with "CONNECT BY" in 9i and also could you please tell about this option to re-write CONNECT BY as a join?
    Thank you very much,
    Victor

  • Header and Footers don't delete with edit text tool!?

    On certain pages I try to delete the header and footer and they won't delete with the edit text tool. I have to go and update the header and footer on certain pages and correct that way...there has to be an easier way, it worked on the adobe's in the past. I'm about to down grade to a older version of Adobe reader because of this!

    You can downgrade to an older version of Adobe Reader but it won't help since Reader cannot edit PDF files.
    What application are you actually using?

  • WITH Subquery Factoring OR "Scalar SubqueriesRun Another Query per row

    Hi Experts
    Please suggest
    which one query is better
    Involved table p is of size 2GB and c1/c2 of size 800M.
    And we have to run a report on p which will do FTS (no where clause on p)
    So FTS on 2 GB table and then running Another Query per row .. so results job very slow
    1)  Select p.id,
             (select sum(q1) from c1 where c1.id = p.id) c1_sum1,
             (select sum(q2) from c2 where c2.id = p.id) c2_sum2
       from p
    2)
    WITH Subquery Factoring
    with c1_vw as
    (select id, sum(q1) c1_sum1
        from c1
             group by id),
       c2_vw as
       (select id, sum(q2) c2_sum2
           from c2
          group by id),
       c1_c2 as
       (select c1.id, c1.c1_sum1, c2.c2_sum2
           from c1_vw c1, c2_vw c2
          where c1.id = c2.id )
       select p.id, c1_sum1, c2_sum2
          from p, c1_c2
         where p.id = c1_c2.id
       / 10.2..0.4
    AIX 5.3
    Thanks In Advance
    ivw

    ivw wrote:
    which one query is betterThe better query IMHO is the one that returns the the correct results in the shortest amount of time using the least system resources (the last two items usually happen at the same time). Maintainability is an issue too. Which one do you like best?
    Its hard to say which query will run best without running both, getting execution plans, and run-time statistics. At a pure guess I would think all things being equal they would have similar performance but do not really know.

  • Multiple equility with subquery

    The following query gives error, I thought I can match multiple columns with subquery, how can I achive this problem?
        select * from answers where (survey_seq_id, main_group_id, sub_group_id) in
        (select survey_seq_id, main_group_id, sub_group_id from surveys s join answers a on s.survey_id = a.survey_seq_id
        where s.qa = 2 and a.main_group_id = 62
        group by survey_seq_id, sub_group_id having sum(decode(answer, 'Yes', 1, 0)) != 1);
    ORA-00979: bir GROUP BY ifadesi değil
    00979. 00000 -  "not a GROUP BY expression"
    *Cause:   
    *Action:
    Error at Line: 12 Column: 27thanks a lot.

    First step lets format your query nicely
    select *
      from answers
    where (
               survey_seq_id
          , main_group_id
          , sub_group_id
           ) in
              select survey_seq_id
                , main_group_id
                , sub_group_id
             from surveys s
             join answers a
               on s.survey_id = a.survey_seq_id
               where s.qa = 2
              and a.main_group_id = 62
               group
               by survey_seq_id
                , sub_group_id
           having sum(decode(answer, 'Yes', 1, 0)) != 1
    Now if you see the query inside IN there are 3 columns in SELECT list and only 2 in GROUP BY list. And your error clearly says +00979. 00000 - "not a GROUP BY expression"+
    main_group_id in the SELECT list is not used in the GROUP BY list
    And to add further your query can be simplified as
    select *
      from (
             select a.*
               , sum(decode(answer, 'Yes', 1, 0)) over(partition by survey_seq_id, main_group_id, sub_group_id) sum_val
               from answers a
               join surveys s
                 on s.survey_id = a.survey_seq_id
               where s.qa = 2
              and a.main_group_id = 62      
    where sum_val != 1;Edited by: Karthick_Arp on Feb 11, 2013 3:05 AM
    Added SQL With analytic function
    Edited by: Karthick_Arp on Feb 11, 2013 3:28 AM
    I missed surveys table in the query :(

Maybe you are looking for

  • ITunes has encountered a problem and needs to close

    Just downloaded latest version of itunes with quicktime. Won't run. Get the Itunes has encountered a problem and needs to close error to Microsoft message. Have latest Windows XP updates as well as latest Ipod updater. Have Norton Antivirus. Looked a

  • How can I configure one of the gateway NI9792 Ethernet port to communicate with a cRIO PAC ?

    Hi NI Engineers, I intend to use my gateway NI9792 the following way: 1. One Ethernet port for network connection. That's how I'll develop it, download software and monitor my application through my PC at my desk. 2. Can the other port be used to com

  • Unable to install few .DMG and .PKG files on my Mac OS X 10.8.1?

    Hi, i just downloaded third party tools and some plugins so i try to install those files (.DMG and .PKG) its throughing Error message as "Your security preferences allow installation of only apps from the Mac App Store and identified developers." so

  • Can I connect Mac Classic's mainboard to the TV?

    Can I connect Mac Classic's mainboard to the TV? I think, the SOUND pin is the analog output of sound. Can i connect the VIDOUT pin to the TV's RCA composite input(In my case it's Yellow plug at the side of tv)?

  • Unable to delete credit memo request

    Hi all, I created a Credit memo request ( Sales document ) and I created Credit memo (Billing) for that.I dont want these both now.Hence I cancelled the credit memo first and now I am trying to delete the Credit memo request.System is not deleting.It