Doubt in a query

Hello,
i want a query that just displays the department_id which has the maximum number of employees with their count
that is ... just a single record ..from employees table. ??
well i tried this query but m getting the whole set from this ...
select department_id, count(employee_id) tot
from employees
group by department_id;

You are almost there
SELECT * FROM (
select department_id, count(employee_id) tot
from employees
group by department_id
order by 2 desc )
WHERE rownum < 2;

Similar Messages

  • Doubt in sql query

    hi frs,
    i have a doubt in sql query.
    this is my query
    select * from scott.emp where comm like '3%'it will fetch all the values starting with 3.
    2nd query
    select * from scott.emp where comm like '%'this will give all the values except null. but i want to get null values also.how can i get i have used following query
    select * from scott.emp where comm like '%' or comm is not nullits working whether there is an any other option.because i am going to use similar kind of condition in my report query if iam going to use or in where condition it will affect the performance.
    pls help
    regards
    Rajesh

    Hi Rajesh,
    I'm sure I do not understand your requirement correctly.
    You say you want to retrieve rows that have or have not null in colum 'comm', right?
    If so, simply get rid of this part of your where clause (provided you have more conditions).
    select * from scott.emp shall be enough.
    Cheers,
    Guido

  • Doubt in forming Query

    Hi,
    I have a doubt in forming query.
    I have a table like this
    Inst_Id port1 sid port2
    1 2300 1 2302
    2 2304 1 2302
    3 2306 1
    4 2300 2
    5 2306 2 2308
    I need a result as for sid = 1(should take union of both port and list out with instd_id)
    Port Inst_Id
    2300 1
    2302 1
    2304 2
    2306 3
    Can any one help to get a query?
    -haifriends

    You simply answer:
    select inst_id,port1 from t where sid=1
    union
    select inst_id,port2 from t where sid=1

  • Doubts in Select query

    Hai,
    I have problem in my select query,
    My previous select query:
      SELECT  rrcty 
            ryear 
            rbukrs
            rzzpspid 
            SUM( hslvt )
            SUM( hsl01 )
            SUM( hsl02 )
            SUM( hsl03 )
            SUM( hsl04 )
            SUM( hsl05 )
            SUM( hsl06 )
            SUM( hsl07 )
            SUM( hsl08 )
            SUM( hsl09 )
            SUM( hsl10 )
            SUM( hsl11 )
            SUM( hsl12 )
            SUM( mslvt )
            SUM( msl01 )
            SUM( msl02 )
            SUM( msl03 )
            SUM( msl04 )
            SUM( msl05 )
            SUM( msl06 )
            SUM( msl07 )
            SUM( msl08 )
            SUM( msl09 )
            SUM( msl10 )
            SUM( msl11 )
            SUM( msl12 )
             FROM zzsl5t
           INTO TABLE it_erbproj
             WHERE rldnr       EQ  c_rldnr        AND
                rrcty      EQ  c_rrcty        AND
                ryear       EQ  v_srr_fyear    AND
                rbukrs      EQ  v_srr_ccode    AND
                racct      EQ  v_racct        AND
                rzzpspid  IN r_zzpspid         
             GROUP BY  RRCTY ryear RBUKRS rzzpspid.
    now i want change the above select query as,
    If user enters input period 03 means,
    i have to select
    SELECT  rrcty 
            ryear 
            rbukrs
            rzzpspid 
            SUM( hslvt )
            SUM( hsl01 )
            SUM( hsl02 )
            SUM( hsl03 )
            SUM( mslvt )
            SUM( msl01 )
            SUM( msl02 )
            SUM( msl03 )
    only, not to select all the periods.
    how can i give fields dynamically.
    please suggest me.
    Elamaran

    Duplicate message. Please close this one and look at my answer Doubt in Select query.

  • Doubt in Firing Query with multiple opportunities UUID/IDs

    HI Folks!
    I might have simple doubt but please help me on this!
    1. I have a custom BO with association to opportunities.
    [DeploymentUnit(CustomerRelationshipManagement)] businessobject Sy_Trade {
    [AlternativeKey] [Label("Trade Id")] element tradeid : BusinessTransactionDocumentID;
    node RelatedOpportunities [0,n]{
                                  element BusinessTransactionDocumentReference : BusinessTransactionDocumentReference;
                                  element BusinessTransactionDocumentRelationshipRoleCode : BusinessTransactionDocumentRelationshipRoleCode;
                                   association RelatedOpportunity[0,1] to Opportunity;
    2. I have success fully used association and i am able to view create all the opportunities related to my custom Bo.
    ISSUE : I want a facet where i just want DISPLAY the activities and sales document assigned in the RELATED OPPORTUNITIES ( N opportunities )
    How do i query with Multiple opportunities ID and fetch the activities against it?
    Btw I want to use query in UI Designer... I have created an  advanced list pane and there i want the result list
    I hope i am clear!
    Thanks in adavance...
    Regards
    Dhruvin

    Hi Ludger,
    I have successfully displayed Related Opportunities associated with trade.( i am able to create , delete also )
    Issue : I am not able to "Display" ( i don't need to edit or create ) all the activities created against all the opportunities in a different tab.
    I tried to approaches :
    1: Query : Created a Query on Activity BO and tried to pass multiple related opportunities ( but seems not possible , please tell me any possibility to pass range of opportunity via transformation or anything? )
    2 : binding : I have a Node Related Opportunity so just tried to bind it with BO model but problem is it is displaying all the activities of first opportunity of the list...
    i think why because :
    In Data model I have created a table bind with Related Opportunities...
    now that node is 1 to N , association to opportunity 0 to 1 , hence i think it fetches only 1 opportunities activity
    should i create like below ( Or is it possible)
    Node Reltdoppts[0,1]
    association [0,N] to opportunity BO ?
    Although i strongly feel SAP should provied us two things :
    1. We need to pass range of opportunities in a query.
    2. We need to just write some absl code where i can fill the table and display it
    and also is there any possibility to create a report or something to display activities as we just want to display the activities!
    P.S : I have been getting a lot of bashing from client because some of the product restriction in cloud! i hope and wish SAP give developers free hand to develop right now its like our hands are tied to many things

  • Doubt in sub-query

    I have a doubt with the use of sub-queries. I am using a query like as below & it is giving me expected result:-
    SELECT ISS.item_type_id,count(1) + (select sum(invoiced_qty) from ppbs_invoice_detail where
    trunc(created_date) between '01-jul-05' and '04-jul-05' and item_type_id=ISS.item_type_id) qty
    FROM ppbs_INV_SIM_SERIAL ISS
    WHERE INSTR('ROAAIT',STATUS)>0
    AND INSTR('NU0NU1NU2NU3SC0',CITY_CODE) =0
    and ISS.item_type_id in ('SM17')
    group by ISS.item_type_id --
    I will re-write above query & i have been using queries like :-
    SELECT ISS.item_type_id,count(1) qty
    FROM ppbs_INV_SIM_SERIAL ISS
    WHERE INSTR('ROAAIT',STATUS)>0
    AND INSTR('NU0NU1NU2NU3SC0',CITY_CODE) =0
    and ISS.item_type_id in ('SM17') and item_type_id in
    (select item_type_id from ppbs_invoice_detail where
    trunc(created_date) between '01-jul-05' and '04-jul-05' and item_type_id=ISS.item_type_id)
    group by ISS.item_type_id
    my doubt here is that the sub-query in the first query is coming before i use the table 'ppbs_inv_sim_serial ISS' whereas in the second query, the table use 'ppbs_inv_sim_serial ISS' is coming before the sub-query use. I have been using queries where table name is defined before the sub-query.
    I hope, my question is clear. Please help in solving the doubt.
    Regards.

    I don't see a problem with the table aliasing that you seem to doubt, but your first query won't run. I boiled the thing down to basics: SQL>create table t1 (one number, val_1 number );
    Table created.
    SQL>create table t2 (one number, val_2 number );
    Table created.
    SQL>insert into t1 values (1,1);
    1 row created.
    SQL>insert into t2 values (1,2);
    1 row created.
    SQL>select a.one, count(1) + ( select sum(val_2) from t2 where t2.one = a.one) qty
      2  from  t1 a
      3  group by one;
    select a.one, count(1) + ( select sum(val_2) from t2 where t2.one = a.one) qty
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    SQL>
    SQL>select a.one, count(1) qty
      2  from   t1 a
      3  where  a.one in ( select one from t2 where one = a.one)
      4  group by one;
           ONE        QTY
             1          1It's superfluous to "where a.one in ( select.. where = a.one) but that's your code basically. I would just do "="

  • Doubts on datapump query parameter

    Hi,
    Oracle Version : 10.2.0.1
    Operating system:Windows
    Can any one please tell me the difference between the two export statements where i user Query parameter in my export .
    E:\oracle\dbdump>expdp scott/tiger directory=dbdump dumpfile=partion.dmp logfile=partion.log exclude=statistics,grants tables=emp QUERY=emp:'"where deptno<20"'
    Export: Release 10.2.0.1.0 - Production on Wednesday, 21 October, 2009 11:47:55
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Starting "SCOTT"."SYS_EXPORT_TABLE_01":  scott/******** directory=dbdump dumpfile=partion.dmp logfile=partion.log exclude=statistics,grants tables=emp QUERY=emp:'where deptno<20'
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 64 KB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    ORA-31693: Table data object "SCOTT"."EMP" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
    Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
      E:\ORACLE\DBDUMP\PARTION.DMP
    Job "SCOTT"."SYS_EXPORT_TABLE_01" completed with 1 error(s) at 11:48:06
    E:\oracle\dbdump>expdp scott/tiger directory=dbdump dumpfile=partion.dmp logfile=partion.log exclude=statistics,grants tables=emp QUERY='"where deptno<20"'
    Export: Release 10.2.0.1.0 - Production on Wednesday, 21 October, 2009 11:57:32
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Starting "SCOTT"."SYS_EXPORT_TABLE_01":  scott/******** directory=dbdump dumpfile=partion.dmp logfile=partion.log exclude=statistics,grants tables=emp QUERY='where deptno<20'
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 64 KB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    . . exported "SCOTT"."EMP"                               7.375 KB       3 rows
    Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
    Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
      E:\ORACLE\DBDUMP\PARTION.DMP
    Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 11:57:44

    Hi,
    Here another doubt i am trying to take a full dump of the scott schema and i want the emp table data based on the salary condition .But i am getting the following error .Please help me that we can't user query option when taking full schema dump.
    E:\oracle\dbdump>expdp scott/tiger directory=dbdump dumpfile=full_1.dmp logfile=full_1.log exclude=statistics,grants  QUERY=scott.emp:'"where sal<3000"'
    Export: Release 10.2.0.1.0 - Production on Wednesday, 21 October, 2009 12:14:44
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/******** directory=dbdump dumpfile=full_1.dmp logfile=full_1.log exclude=statistics,grants QUERY=scott.emp:'where sal<3
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 192 KB
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type SCHEMA_EXPORT/TABLE/COMMENT
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    ORA-31693: Table data object "SCOTT"."DEPT" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    ORA-31693: Table data object "SCOTT"."EMP" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    ORA-31693: Table data object "SCOTT"."SALGRADE" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    . . exported "SCOTT"."BONUS"                                 0 KB       0 rows
    Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
      E:\ORACLE\DBDUMP\FULL_1.DMP
    Job "SCOTT"."SYS_EXPORT_SCHEMA_01" completed with 3 error(s) at 12:14:56
    E:\oracle\dbdump>expdp scott/tiger directory=dbdump dumpfile=full_11.dmp logfile=full_11.log exclude=statistics,grants  QUERY='"where sal<3000"'
    Export: Release 10.2.0.1.0 - Production on Wednesday, 21 October, 2009 12:30:30
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/******** directory=dbdump dumpfile=full_11.dmp logfile=full_11.log exclude=statistics,grants QUERY='where sal<3000'
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 192 KB
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type SCHEMA_EXPORT/TABLE/COMMENT
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    ORA-31693: Table data object "SCOTT"."DEPT" failed to load/unload and is being skipped due to error:
    ORA-00904: "SAL": invalid identifier
    . . exported "SCOTT"."EMP"                               7.703 KB      11 rows
    ORA-31693: Table data object "SCOTT"."SALGRADE" failed to load/unload and is being skipped due to error:
    ORA-00904: "SAL": invalid identifier
    . . exported "SCOTT"."BONUS"                                 0 KB       0 rows
    Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
      E:\ORACLE\DBDUMP\FULL_11.DMP
    Job "SCOTT"."SYS_EXPORT_SCHEMA_01" completed with 2 error(s) at 12:30:51

  • Doubt in ABAP query

    hi all
      Can a field be added to the selection screen of a query if that field doesnot exist in any of the tables which have been joined for that infoset .
    Any pointers to this will be very helpful.
    Thanks.

    Hi,
    I think you can create some dynamic selections at the Infoset level.  There you can find selection screen and selection screen events.
    Thanks,
    Vamshi.

  • I have doubt in insert query...

    hi everybody..
    I want to insert values for one table from another and also in the query i have to assign the values....
    for ex:
    insert into tname (col1,col2,col3=?) (select col1,col2 from another table)
    in above example col 1 & 2 from another table and for col3 i have to assign the values ... my question is that how to assign the values in the same query itself

    You can also try :
    If the value for col3 is going to be unique then ,
    insert into tname (col1,col2,col3) (select col1,col2,'unique value' from anothe_table)
    If the value for col3 is not going to be unique then (store those values in some temp table) ,
    insert into tname (col1,col2,col3) (select a.col1,a.col2,b.val from another_table a, another_table_p b
    where a.key=b.key )

  • Doubt in Update query

    I have a problem using update query, for updating one column in a table with another column in another table. For eg say i have two tables, collector and survey
    Fields in Collector:
    col_n_account_num
    col_v_email
    col_n_phone_number
    Fields in survey
    sur_v_question_id
    sur_n_account_num
    sur_v_response
    update collector
    case when sur_v_question_id=collector_email then col_v_email=sur_v_response end,
    case when sur_v_question_id=collector_phone then col_n_phone_number=sur_v_response end
    Thanks in advance
    Regards,
    ss

    write two simple update statements
    update collector set col_v_email =
    (select sur_v_response from survey
    where sur_v_question_id=collector_email )
    and
    update collector set col_n_phone_number =
    (select sur_v_response from survey
    where sur_v_question_id=collector_phone)

  • Doubt in SELECT query (11.2.0.2.0)

    I have 3 tables
    1. ADBO.SECMASTER_DTL_EXT_HST_TBL
    2. BDBO.SECMASTER_DETAIL_EXT_HIST
    3. ADBO.SPOKE_TO_HUB_SEC_MTCH_TBL
    ADBO.SECMASTER_DTL_EXT_HST_TBL and BDO.SECMASTER_DETAIL_EXT_HIST have exactly the same table structure.
    Now, I need to find out the records from table BDO.SECMASTER_DETAIL_EXT_HIST with the max effective_date
    which do not match to the effective_date in ADBO.SECMASTER_DTL_EXT_HST_TBL. In the results table I need to report the diff effective dates from the 2 tables if they do not match.
    Also, SRC_INTFC_INST has to be 140 in both 1 and 2 tables. Further security_alias of table 1 has to match with spoke_sec of table 3
    and security_alias of table 2 has to match with hub_sec of table 3.
    For the data I have , I am getting 2 rows whereas I am expecting only 1 row. Can anyone suggest why this is so??
       SELECT
             B.SECURITY_ALIAS,
              TO_CHAR (C.SPOKE_PAID),
              A.SECURITY_ALIAS,
              TO_CHAR (C.HUB_PAID),
              'SECMASTER_DETAIL_EXT_HIST',
              'EFFECTIVE_DATE',
              NVL ( (CAST (B.EFFECTIVE_DATE AS VARCHAR2 (100))),
                   'No Records Found'),
              NVL ( (CAST (A.EFFECTIVE_DATE AS VARCHAR2 (100))),
                   'No Records Found')
         FROM ADBO.SECMASTER_DTL_EXT_HST_TBL  A,
              (SELECT SECURITY_ALIAS, EFFECTIVE_DATE, SRC_INTFC_INST
                 FROM [email protected]) B,
              ADBO.SPOKE_TO_HUB_SEC_MTCH_TBL C
        WHERE     A.SRC_INTFC_INST = 140
              AND B.SRC_INTFC_INST = 140
              AND A.SECURITY_ALIAS = C.spoke_sec
              AND b.security_alias = C.HUB_SEC
              AND TO_CHAR (a.effective_date,'DD-MON-YYYY')
               <> TO_CHAR((SELECT MAX (h.effective_date)
                        FROM [email protected] H                    
                         where h.security_alias = b.security_alias
                             AND h.src_intfc_inst = b.src_intfc_inst), 'DD-MON-YYYY')
            and a.security_alias='6313';
    Insert into ADBO.SECMASTER_DTL_EXT_HST_TBL
       (SECURITY_ALIAS, SRC_INTFC_INST, EFFECTIVE_DATE)
    Values
       (6313, 140, TO_DATE('05/15/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into BDBO.SECMASTER_DETAIL_EXT_HIST
       (SECURITY_ALIAS, SRC_INTFC_INST, EFFECTIVE_DATE)
    Values
       (327667, 140, TO_DATE('05/20/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into BDBO.SECMASTER_DETAIL_EXT_HIST
       (SECURITY_ALIAS, SRC_INTFC_INST, EFFECTIVE_DATE)
    Values
       (327667, 140, TO_DATE('05/15/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into ADBO.SPOKE_TO_HUB_SEC_MTCH_TBL
       (SPOKE_PAID, SPOKE_SEC, LAST_HELD_DATE, PREV_HELD_DATE, HUB_PAID, HUB_SEC)
    Values
       ('L3083                                                                                        ', 6313, TO_DATE('07/18/2013 22:15:46', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/15/2013 22:15:30', 'MM/DD/YYYY HH24:MI:SS'), 'L3083                                                                                        ',
        327667);
    CREATE TABLE ADBO.SECMASTER_DTL_EXT_HST_TBL
      SECURITY_ALIAS                  NUMBER        NOT NULL,
      SRC_INTFC_INST                  NUMBER        NOT NULL,
      EFFECTIVE_DATE                  DATE          NOT NULL
    CREATE TABLE BDBO.SECMASTER_DETAIL_EXT_HIST
      SECURITY_ALIAS                  NUMBER,
      SRC_INTFC_INST                  NUMBER,
      EFFECTIVE_DATE                  DATE
    CREATE TABLE ADBO.SPOKE_TO_HUB_SEC_MTCH_TBL
      SPOKE_PAID      VARCHAR2(100 BYTE),
      SPOKE_SEC       NUMBER,
      LAST_HELD_DATE  DATE,
      PREV_HELD_DATE  DATE,
      HUB_PAID        VARCHAR2(100 BYTE),
      HUB_SEC         NUMBER

    Hi,
    one suggestion. Don't include schema in the table.
    I have created your tables in my db with the following names:
    a_secmaster_dtl_ext_hst_tbl
    b_secmaster_detail_ext_hist
    spoke_to_hub_sec_mtch_tbl
    You query may be solved in this way maybe, according to what I have understood in the previous post.
    with table_a as
       select a.security_alias
            , c.spoke_paid
            , c.hub_paid
            , a.effective_date
         from a_secmaster_dtl_ext_hst_tbl  a
              join spoke_to_hub_sec_mtch_tbl c
                 on (a.security_alias=c.spoke_sec)
        where a.src_intfc_inst = 140
          and a.effective_date = (select max(a2.effective_date)
                                    from a_secmaster_dtl_ext_hst_tbl a2
                                   where a.security_alias=a2.security_alias
                                     and a.src_intfc_inst=a2.src_intfc_inst)
    , table_b as
       select b.security_alias
            , c.spoke_paid
            , c.hub_paid
            , b.effective_date
         from b_secmaster_detail_ext_hist  b
              join spoke_to_hub_sec_mtch_tbl c
                 on (b.security_alias=c.hub_sec)
        where b.src_intfc_inst = 140
          and b.effective_date = (select max(b2.effective_date)
                                    from b_secmaster_detail_ext_hist b2
                                   where b.security_alias=b2.security_alias
                                     and b.src_intfc_inst=b2.src_intfc_inst)
    select b.security_alias
         , a.spoke_paid
         , a.security_alias
         , b.hub_paid
         , 'SECMASTER_DETAIL_EXT_HIST' txt1
         , 'EFFECTIVE_DATE'            txt2
         , nvl(to_char(b.effective_date,'dd-mon-yyyy'), 'No Records Found') b_eff_date
         , nvl(to_char(a.effective_date,'dd-mon-yyyy'), 'No Records Found') a_eff_date   
      from table_a a full outer join table_b b on(a.spoke_paid=b.hub_paid)
    where a.effective_date!=b.effective_date;
    I have used full outer join to join the table to cover the case where records are present in table a and not in table b and the opposite.
    Regards.
    Alberto

  • Doubt in Select Query

    Hi,
    I want to get data from 2 table which query is effeicient one
    by seeing performance...
    1. using for all entries statement
    2. Get data using join query.
    Thanks in advance

    FOR ALL ENTRIES is better for some reasons,
    --> If the data is huge , then some times JOIN may end up in TIME OUT error
    --> FOR ALL ENTRIES will use the INDEXEs of the tables and improves the performance

  • Small doubt in select query

    i want to count the no. of employees whose endda = '31/12/9999' and stat2 = '3'.
    tables are pa0000.
    can anyone tell me the select query?

    DATA: w_noemp TYPE i.
    SELECT COUNT(*) INTO w_noemp FROM  pa0000
           WHERE  endda  = '99991231'
           AND    stat2  = '3'.

  • Doubt on SQl query for invoices

    Hi All,
    I have a query which pulls the payment proposal for the standard invoices and credit memo's
    being posted into the system from the table BKPF and BSIK.
    I just want to pull the payment proposal for standard invoices rather than credit memo's.
    I found that the only difference is the field SHKZG i.e Debit/Credit indicator.
    But i also want to see if it impacts subsequent Debit and Subsequent Credit since
    i see these value in Value range of the field.
    thanks,

    Hello ,
    if  Credit\ debit  info is required you have to use BSEG and VBSEGK for items details for the header
    BKPF ,
    Regards,
    Kiran Kumar

  • Doubt on Sql query tuning

    Hi all,
    I had posted a thread named : SQL Tuning - Author name Nnirmalkumar.
    But i didnt get any reply on it. Can anyone help me out .
    Thanks in advance.

    Hi Rob Schenk & sivamurugesh
    As per you asked following is the thread which i have posted. Please do have a look.
    The query is inside the procedure its a dynamic query thats y there would be lots of sub-queries which canot be put in a single sub-query.
    SQL TUNNING
    Performance Issue
    The first thread conists of the procedure with the query.
    Thanks in advance.

Maybe you are looking for

  • Is empty string and Null same?

    create table x (empid number); Table created. insert into x values (''); 1 row created. insert into x values (null); 1 row created. SQL> set null <<>> SQL> select * from x;      EMPID <<>> <<>>So i can safely change an Insert statement like insert in

  • NOKIA N80 Internal Error Message PLEASE HELP

    Does anbody Know why I Get an Internal Error Message When I Send a Multimedia Message.... Everytime I Try to Send a Picture as Multimedia it Says Unable to Send Message and When I Click Details it Says Internal Error....... Please Help

  • Some symbols gets prefixed  to a specific field in validation statement.

    Hi All, I am beginner in SAP MDM and facing an issue in validations in Data Manager. Some symbols gets prefixed  to a specific field in validation statement. Any ideas,in what situation does it happen i.e. due to any repository operation from console

  • How to present a link to job (I want to bypass job output cycle wizard)

    Dear firends How to present a link to job (I want to bypass job output cycle wizard to open MyExample.BQY) http://MyServer:45000/workspace/browse/get/KursHYP2008/siyavus/MyExample?jobOutput=true&user=admin&pass=password this link shows wizard to open

  • ECM OADP exceprtion

    Hello All, I have linked a function module to the editable column AMOUNT in OADP (MSS ECM) of compensation planning view and is getting the following exception: java.lang.ClassCastException: java.lang.String incompatible with com.sap.xss.ser.oadp.jav