Can we replace this SELECT query by more efficient code

can we replace this SELECT query by more efficient code ?:-
SELECT * FROM zv7_custord
     INTO TABLE G_T_ZV7_CUSTORD
     WHERE ( SENDER in S_SENDER and
             ORDNUM in S_ORDER  and
             ZDATE   in S_DATE ) OR
           ( SENDER in S_SENDER AND
             STATUS = SPACE )
     ORDER BY IDOCNUM.

Hi
U can leave ORDER BY option and sort the table by yourself and try to split the query:
SELECT * FROM zv7_custord
     INTO TABLE G_T_ZV7_CUSTORD
     WHERE  SENDER in S_SENDER and
                   ORDNUM in S_ORDER  and
                   ZDATE   in S_DATE .
SELECT * FROM zv7_custord
     APPENDING TABLE G_T_ZV7_CUSTORD
     WHERE  SENDER in S_SENDER        and
                   NOT ORDNUM in S_ORDER  and
                   NOT ZDATE   in S_DATE       and
                   STATUS = SPACE
or
SELECT * FROM zv7_custord
     INTO TABLE G_T_ZV7_CUSTORD
     WHERE  SENDER in S_SENDER and
                   ORDNUM in S_ORDER  and
                   ZDATE   in S_DATE .
SELECT * FROM zv7_custord
     APPENDING TABLE G_T_ZV7_CUSTORD
     WHERE  SENDER in S_SENDER        and
                   STATUS = SPACE.
* Sort the table key fields
SORT G_T_ZV7_CUSTORD BY <KEY1> <KEY2> .....
DELETE ADJACENT DUPLICATES FROM G_T_ZV7_CUSTORD COMPARING <KEY1> .....
Max

Similar Messages

  • What can i do for removing SINGLE in this select query??

    What can i do for removing SINGLE in this select query given below and also NOT USE 'ENDSELECT'??
    I have defined g_t_zv7_cachemapping as following ::
    DATA : BEGIN OF g_t_zv7_cachemapping OCCURS 0,
             kostl LIKE zv7_cachemapping-kostl,
             END OF g_t_zv7_cachemapping.
    SELECT SINGLE kostl FROM zv7_cachemapping INTO g_t_zv7_cachemapping
               WHERE  auart = g_t_vbak-auart.
            IF sy-subrc = 0 .
            ENDIF.

    Shashank,
    DATA : BEGIN OF g_t_zv7_cachemapping OCCURS 0,
    AUART LIKE zv7_cachemapping-AUART,
    kostl LIKE zv7_cachemapping-kostl,
    END OF g_t_zv7_cachemapping.
    If not g_t_vbak[] is initial.
    SELECT auart kostl
      FROM zv7_cachemapping INTO table g_t_zv7
    for all entries in g_t_vbak
    WHERE auart = g_t_vbak-auart.
    Endif.
    sort : g_t_zv7 by auart , 
              g_t_vbak by auart.
    loop at g_t_vbak.
      READ TABLE g_t_zv7 WITH KEY AUART = g_t_vbak-AUART
                                        BINARY SEARCH.
       IF sy-subrc eq 0.
       ENDIF.
    endloop.
    Pls. reward if useful

  • Please help me what other way i can tune this select query..

    Hello Guru,
    I have a select query which retrieve data from 10 tables and around 4 tables having 2-4 Lac record and rest are having 80,000 - 1 Lac record.
    It is taking around 7-8 seconds to fetch 55000 record.
    I was strictly told by the client that i should not use HINTS in my query. My query is below. Please help me what other way i can tune this select query..
    select
    CT.CUST_ID
    ,CT.ROMANISED_SURNAME
    ,CT.SURNAME
    ,CT.ROMANISED_GIVEN_NAME
    ,CT.GIVEN_NAME
    ,CT.ROMANISED_MIDDLE_NAME
    ,CT.MIDDLE_NAME
    ,CT.ROMANISED_NAME_SUFFIX
    ,CT.NAME_SUFFIX
    ,CT.ROMANISED_TITLE
    ,CT.TITLE
    ,CT.ROMANISED_NAME_INITIALS
    ,CT.NAME_INITIALS
    ,CT.NAME_TEXT
    ,CT.CUST_JRNY_ID
    ,RK.REMARK_TYPE
    ,RK.REMARK_ID+CT.CUST_ID as REMARK_ID
    ,RK.REMARK_STATUS
    ,RK.REMARK_TEXT
    ,RK.HOST_ONLY_IND
    ,RK.SUPERVISORY_IND
    ,RK.CUST_COMM_IND
    ,RK.REMARK_SEQ
    ,RK.REMARK_CODE
    ,RK.DEFAULT_CUST_REL_IND
    ,RK.DEFAULT_FLIGHT_SEG_REL_IND
    ,RK.IATA_CODE
    ,RK.ICAO_CODE
    ,CJ.RECORD_LOCATOR "SITA_RECORD_LOCATOR"
    ,Cjv.Record_Locator "ORIGINATOR_RECORD_LOCATOR"
    ,FS.TRAVELLING_GROUP_CODE
    ,CG.GROUP_NAME
    FROM FLIGHT_LEG FL
    ,CUST_FLIGHT_LEG CFL
    ,CUST CT
    ,CUST_REMARK CTR
    ,REMARK RK
    ,FLIGHT_SEG_FLIGHT_LEG FSFL
    ,FLIGHT_SEG FS
    ,CUST_JRNY CJ
    ,CUST_JRNY_VERSION CJV
    ,CUST_GROUP CG
    WHERE FL.OPR_FLIGHT_NUMBER = 1--I_OPR_FLIGHT_NUMBER
    and FL.HISTORY_VERSION_NUMBER = 0
    and FL.DEPARTURE_STATION_CODE = 'DEL'--I_DEPARTURE_STATION_CODE
    and FL.DEPARTURE_DATETIME = TO_DATE('10-DEC-2012 18.45.00', 'DD-MON-YYYY HH24.MI.SS')
    and FL.OPR_SERVICE_PROVIDER_CODE= 'AI'--i_opr_service_provider_code
    and FL.OPR_FLIGHT_SUFFIX = 'A'--NVL(I_OPR_FLIGHT_SUFFIX, FL.OPR_FLIGHT_SUFFIX)
    AND FL.FLIGHT_LEG_ID = CFL.FLIGHT_LEG_ID
    AND CFL.CUST_ID = CT.CUST_ID
    AND FL.FLIGHT_LEG_ID=FSFL.FLIGHT_LEG_ID
    AND FSFL.FLIGHT_SEG_ID=FS.FLIGHT_SEG_ID
    AND CT.CUST_ID = CTR.CUST_ID(+)
    AND CTR.REMARK_ID = RK.REMARK_ID(+)
    AND FL.CUST_JRNY_ID = CJ.CUST_JRNY_ID
    and CJ.CUST_JRNY_ID = CJV.CUST_JRNY_ID
    AND CG.CUST_JRNY_ID(+) = CT.CUST_JRNY_ID
    AND CFL.HISTORY_VERSION_NUMBER = 0
    AND CT.HISTORY_VERSION_NUMBER = 0
    AND NVL(CTR.HISTORY_VERSION_NUMBER,0) = 0
    AND NVL(RK.HISTORY_VERSION_NUMBER,0) = 0
    AND FS.HISTORY_VERSION_NUMBER = 0
    AND FSFL.HISTORY_VERSION_NUMBER = 0
    -- AND CJ.HISTORY_VERSION_NUMBER = 0
    and CJV.VERSION_NUMBER = 0 --- Need to check
    AND NVL(CG.HISTORY_VERSION_NUMBER,0) = 0
    order by CT.CUST_JRNY_ID,CT.CUST_ID;
    The Tables having record:
    select COUNT(*) from FLIGHT_LEG -----241756
    select COUNT(*) from CUST_FLIGHT_LEG---632585
    select COUNT(*) from CUST---240015
    select COUNT(*) from CUST_REMARK---73724
    select COUNT(*) from REMARK---73654
    select COUNT(*) from FLIGHT_SEG_FLIGHT_LEG---241789
    select COUNT(*) from FLIGHT_SEG----260004
    select COUNT(*) from CUST_JRNY----74288
    select COUNT(*) from CUST_JRNY_VERSION----74477
    select COUNT(*) from CUST_GROUP----55819
    Thanks,
    HP..

    Plan hash value: 3771714931
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 10239 | 2949K| | 7515 (1)| 00:01:31 | | |
    | 1 | SORT ORDER BY | | 10239 | 2949K| 3160K| 7515 (1)| 00:01:31 | | |
    |* 2 | HASH JOIN | | 10239 | 2949K| | 6864 (1)| 00:01:23 | | |
    | 3 | PARTITION HASH ALL | | 73687 | 1079K| | 417 (1)| 00:00:06 | 1 | 512 |
    |* 4 | TABLE ACCESS FULL | CUST_JRNY_VERSION | 73687 | 1079K| | 417 (1)| 00:00:06 | 1 | 512 |
    |* 5 | HASH JOIN | | 10239 | 2799K| | 6445 (1)| 00:01:18 | | |
    | 6 | PARTITION HASH ALL | | 73654 | 863K| | 178 (1)| 00:00:03 | 1 | 512 |
    | 7 | TABLE ACCESS FULL | CUST_JRNY | 73654 | 863K| | 178 (1)| 00:00:03 | 1 | 512 |
    |* 8 | FILTER | | | | | | | | |
    |* 9 | HASH JOIN RIGHT OUTER | | 10239 | 2679K| | 6267 (1)| 00:01:16 | | |
    | 10 | PARTITION HASH ALL | | 55315 | 756K| | 137 (1)| 00:00:02 | 1 | 512 |
    | 11 | TABLE ACCESS FULL | CUST_GROUP | 55315 | 756K| | 137 (1)| 00:00:02 | 1 | 512 |
    |* 12 | FILTER | | | | | | | | |
    |* 13 | HASH JOIN OUTER | | 10240 | 2540K| 2056K| 6129 (1)| 00:01:14 | | |
    |* 14 | FILTER | | | | | | | | |
    |* 15 | HASH JOIN RIGHT OUTER | | 10242 | 1930K| | 5531 (1)| 00:01:07 | | |
    | 16 | INDEX FAST FULL SCAN | CUST_REMARK_PK | 73677 | 935K| | 190 (0)| 00:00:03 | | |
    |* 17 | HASH JOIN | | 10257 | 1802K| | 5339 (1)| 00:01:05 | | |
    |* 18 | HASH JOIN | | 10257 | 701K| | 3516 (1)| 00:00:43 | | |
    |* 19 | HASH JOIN | | 3963 | 220K| | 2476 (1)| 00:00:30 | | |
    |* 20 | HASH JOIN | | 3963 | 181K| | 1300 (1)| 00:00:16 | | |
    | 21 | PARTITION HASH ALL | | 3963 | 131K| | 728 (1)| 00:00:09 | 1 | 512 |
    |* 22 | TABLE ACCESS FULL | FLIGHT_LEG | 3963 | 131K| | 728 (1)| 00:00:09 | 1 | 512 |
    |* 23 | INDEX FAST FULL SCAN| FLIGHT_SEG_FLIGHT_LEG_PK | 240K| 3059K| | 571 (1)| 00:00:07 | | |
    | 24 | PARTITION HASH ALL | | 259K| 2531K| | 1175 (1)| 00:00:15 | 1 | 512 |
    |* 25 | TABLE ACCESS FULL | FLIGHT_SEG | 259K| 2531K| | 1175 (1)| 00:00:15 | 1 | 512 |
    | 26 | PARTITION HASH ALL | | 631K| 8011K| | 1037 (1)| 00:00:13 | 1 | 512 |
    |* 27 | TABLE ACCESS FULL | CUST_FLIGHT_LEG | 631K| 8011K| | 1037 (1)| 00:00:13 | 1 | 512 |
    | 28 | PARTITION HASH ALL | | 239K| 25M| | 1822 (1)| 00:00:22 | 1 | 512 |
    |* 29 | TABLE ACCESS FULL | CUST | 239K| 25M| | 1822 (1)| 00:00:22 | 1 | 512 |
    | 30 | PARTITION HASH ALL | | 73623 | 4385K| | 243 (1)| 00:00:03 | 1 | 512 |
    | 31 | TABLE ACCESS FULL | REMARK | 73623 | 4385K| | 243 (1)| 00:00:03 | 1 | 512 |
    Predicate Information (identified by operation id):
    2 - access("CJ"."CUST_JRNY_ID"="CJV"."CUST_JRNY_ID")
    4 - filter("CJV"."VERSION_NUMBER"=0)
    5 - access("FL"."CUST_JRNY_ID"="CJ"."CUST_JRNY_ID")
    8 - filter(NVL("CG"."HISTORY_VERSION_NUMBER",0)=0)
    9 - access("CG"."CUST_JRNY_ID"(+)="CT"."CUST_JRNY_ID")
    12 - filter(NVL("RK"."HISTORY_VERSION_NUMBER",0)=0)
    13 - access("CTR"."REMARK_ID"="RK"."REMARK_ID"(+))
    14 - filter(NVL("CTR"."HISTORY_VERSION_NUMBER",0)=0)
    15 - access("CT"."CUST_ID"="CTR"."CUST_ID"(+))
    17 - access("CFL"."CUST_ID"="CT"."CUST_ID")
    18 - access("FL"."FLIGHT_LEG_ID"="CFL"."FLIGHT_LEG_ID")
    19 - access("FSFL"."FLIGHT_SEG_ID"="FS"."FLIGHT_SEG_ID")
    20 - access("FL"."FLIGHT_LEG_ID"="FSFL"."FLIGHT_LEG_ID")
    22 - filter("FL"."DEPARTURE_STATION_CODE"='DEL' AND "FL"."DEPARTURE_DATETIME"=TO_DATE(' 2012-12-10 18:45:00', 'syyyy-mm-dd
    hh24:mi:ss') AND "FL"."OPR_SERVICE_PROVIDER_CODE"='AI' AND "FL"."OPR_FLIGHT_NUMBER"=1 AND "FL"."OPR_FLIGHT_SUFFIX"='A' AND
    "FL"."HISTORY_VERSION_NUMBER"=0)
    23 - filter("FSFL"."HISTORY_VERSION_NUMBER"=0)
    25 - filter("FS"."HISTORY_VERSION_NUMBER"=0)
    27 - filter("CFL"."HISTORY_VERSION_NUMBER"=0)
    29 - filter("CT"."HISTORY_VERSION_NUMBER"=0)

  • How can i join this two query?

    I have two table table employee and CSEReduxResponses
    In table employee i have
    CREATE TABLE [dbo].[employee](
    [emp_id] [int] IDENTITY(1,1) NOT NULL,
    [emp_namefirst] [varchar](255) NOT NULL,
    [emp_namemiddle] [varchar](50) NULL,
    [emp_namelast] [varchar](255) NOT NULL
    on responds i have 
    CREATE TABLE [dbo].[CSEReduxResponses](
    [response_id] [int] IDENTITY(1,1) NOT NULL,
    [employee] [int] NOT NULL,
    [employeedept] [int] NOT NULL,
    [star] [tinyint] NOT NULL,
    [status] [int] NOT NULL,
    [approvedby] [int] NULL,
    [approveddate] [datetime] NULL,
    [execoffice_status] [int] NULL,
    Im trying to get the employee with the MAX execpffice_status( this is either a 1 or 0).
    i have this query that i made for it
    select top(1) with ties employee, SUM(execoffice_status) as 'total'
    from   CSEReduxResponses
    group by employee
    order by 'total' desc
    my query for employee table is 
       select emp_namefirst as first , emp_namelast as [last]
    from phonelist.dbo.employee where emp_namefirst is not null
    How can i get this 2 query together so i can output the employee (first and last )name
    with the max exeoffice_status?
    i use :
    Microsoft SQL Server Management Studio 10.0.2531.0
    ps: sorry if i put this is the wrong forum, this is my first time here and first post.

    Are you looking for the below?
    CREATE TABLE [dbo].[employee](
    [emp_id] [int] IDENTITY(1,1) NOT NULL,
    [emp_namefirst] [varchar](255) NOT NULL,
    [emp_namemiddle] [varchar](50) NULL,
    [emp_namelast] [varchar](255) NOT NULL
    Insert into Employee Values('abc','bcd','cdf')
    Insert into Employee Values('xyz','yxw','xwv')
    CREATE TABLE [dbo].[CSEReduxResponses](
    [response_id] [int] IDENTITY(1,1) NOT NULL,
    [employee] [int] NOT NULL,
    [employeedept] [int] NOT NULL,
    [star] [tinyint] NOT NULL,
    [status] [int] NOT NULL,
    [approvedby] [int] NULL,
    [approveddate] [datetime] NULL,
    [execoffice_status] [int] NULL,
    Insert into [CSEReduxResponses]( employee,employeedept,star,status,approvedby,approveddate,execoffice_status)
    Values(1,100,1,1,1,GETDATE(),0),
    (1,100,1,1,1,GETDATE(),1),
    (2,100,1,1,1,GETDATE(),0)
    ;With cte as( Select *,SUM([execoffice_status]) over(partition by Employee) sumstatus From [CSEReduxResponses] )
    Select Distinct A.*,B.sumstatus
    From Employee A
    Inner Join cte B On A.emp_id = B.employee
    --OR
    ;With cte as( Select employee ,SUM([execoffice_status]) sumstatus From [CSEReduxResponses] group by Employee)
    Select Distinct A.*,(Select sumstatus From cte B where A.emp_id = B.employee)
    From Employee A
    Drop table Employee,[CSEReduxResponses]

  • Can anyone expalin this FMS query?

    Dear Expert,
    Can anyone expalin this FMS query, which follows
    Query1:
    IF $[ORDR.U_QuoOppNum] is NULL or $[ORDR.U_QuoOppNum] = ''
    BEGIN
      SELECT  T0.Name  as 'Segments' 
         FROM [dbo].[@SEGMENT] T0
         Where SUBSTRING( T0.Code, 1, 3 ) = SUBSTRING( $[ORDR.U_QuoTypSeg], 1, 3)
    END
    ELSE
      SELECT T0.U_OppSeg FROM OOPR T0  where T0.OpprId = $[ORDR.U_QuoOppNum]
    Query2:
    SELECT  code
    FROM [@SEGMENT] T0
    Where SUBSTRING( T0.Code, 1, 3 ) = SUBSTRING( $[ORDR.U_QuoTypSeg], 1, 3)
    AND Name = $[ORDR.U_QuoSeg]
    Thanks in advance,
    Dwarak

    Dear Dwarak,
    The 1st query assign UDF U_OppSeg value from Sales Opportunity to Sales order if U_QuoOppNum in sales order matches opportunity ID. Otherwise, assign Name value in UDT @SEGMENT where the first 3 letters match with sales order UDF U_QuoTypSeg.
    The 2nd query is the first part of the previous query after IF. I explained in the 2nd half.
    Thanks,
    Gordon

  • How can I make this complex query?

    I don’t know how can I do this complex query...
    I have the tables Customers, Vehicles and Models. A customer can have 0-N Vehicles and a vehicle have 1 Model.
    Customers: ID_Customer (PK), Name, LastName...
    Vehicles: ID_Vehicle (PK), ID_Customer, ID_Model, date_sale
    Models: ID_Modelo (PK), Model_Name
    Then I need to know the buy average time (date_sale) between 2 models (ID_Model)
    For example I have these Vehicles:
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    1................................123....................1.............21/05/2000
    2................................459....................3............ 16/08/2000
    3................................123....................2............ 28/06/2001
    4................................516....................1............ 09/09/2001
    5................................459....................4............ 18/10/2002
    6................................516....................2............ 20/12/2002
    If I want to know the buy average time (date_sale) between ID_Model 1 and ID_Model 2 it is. (403 + 467) / 2 = 435 days !!!
    * Customer 123 (model 1 to 2): 25/06/2001 – 21/05/2000 ==> 403 days
    * Customer 516 (model 1 to 2): 01/12/2002 – 01/05/2000 ==> 467 days.
    I need to do the query for all the combination models. For example If I have the Models 1, 2 and 3 I need to obtain:
    Source_Model.....Target_Model....Buy_Average_Time
    1......................................1....................... xxx days
    1......................................2....................... xxx days
    1......................................3....................... xxx days
    2......................................1....................... xxx days
    2......................................2....................... xxx days
    2......................................3....................... xxx days
    3......................................1....................... xxx days
    3......................................2....................... xxx days
    3......................................3....................... xxx days
    If it is necessary I could create a table with the fields Source_Model, Target_Model and Buy_Average_Time for accelerate the query time response.
    But how can I do this query??????????
    Thanks very much!!!

    Hi,
    Thanks for your reply but It is not correct for me because the Customer could have several vehicles in her life.
    If I make the query with my examples data it is OK
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    1................................123....................1.............21/05/2000
    2................................459....................3............ 16/08/2000
    3................................123....................2............ 28/06/2001
    4................................516....................1............ 09/09/2001
    5................................459....................4............ 18/10/2002
    6................................516....................2............ 20/12/2002
    select v1.id_model as source_model,
    v2.id_model as target_model,
    avg (v2.date_sale - v1.date_sale) || ' days' as buy_average_time
    from vehicles v1,
    vehicles v2
    where v1.id_customer = v2.id_customer
    and v2.date_sale > v1.date_sale
    group by v1.id_model, v2.id_model;
    I received:
    SOURCE_MODEL     TARGET_MODEL     BUY_AVERAGE_TIME
    ..............1................................2.....................................435 days
    ..............3................................4.....................................793 days
    But If I insert a new vehicle:
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    7................................516....................3............ 16/08/2003
    And I execute the query now I receive:
    SOURCE_MODEL     TARGET_MODEL     BUY_AVERAGE_TIME
    ..............1................................2...........................435 days
    ..............1................................3...........................706 days
    ..............2................................3...........................239 days
    ..............3................................4...........................793 days
    It is NO correct because I don’t have the 1 (Source_model) to 3 (Target_model) combination in the Vehicles data!!! (I have 1 to 2 and 2 to 3 but NO 1 to 3!!!!).
    Then the query is not OK for me!
    Besides If I modify the Vehicle 7 data and put ID_Model = 2:
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    7................................516....................2............ 16/08/2003
    I received:
    SOURCE_MODEL     TARGET_MODEL     BUY_AVERAGE_TIME
    ..............1................................2...........................525,33 days
    ..............2................................2...........................239 days
    ..............3................................4...........................793 days
    It is NO correct because the BUY_AVERAGE_TIME for 1 to 2 combination is 435 days (the same of the original query) because I aggregate only the combination 2 to 2 with the ID_VEHICLE 7
    Below I attach the examples scripts.
    Could you help me with this query, please?
    Thanks very much!
    CREATE TABLE VEHICLES
    ID_VEHICLE NUMBER(9),
    ID_CUSTOMER NUMBER(9),
    ID_MODEL NUMBER(9),
    DATE_SALE DATE
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    1, 123, 1, TO_Date( '05/21/2000 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    2, 459, 3, TO_Date( '08/16/2000 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    3, 123, 2, TO_Date( '06/28/2001 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    4, 516, 1, TO_Date( '09/09/2001 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    5, 459, 4, TO_Date( '10/18/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    6, 516, 2, TO_Date( '12/20/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    7, 516, 2, TO_Date( '08/16/2003 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    COMMIT;
    CREATE TABLE MODELS
    ID_MODELO NUMBER(9),
    MODEL_NAME VARCHAR2(25 BYTE)
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    1, 'MODEL 1');
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    2, 'MODEL 2');
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    3, 'MODEL 3');
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    4, 'MODEL 4');
    COMMIT;
    CREATE TABLE CUSTOMERS
    ID_CUSTOMER NUMBER(9),
    NAME VARCHAR2(25 BYTE),
    LASTNAME VARCHAR2(25 BYTE)
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    123, 'Customer 123', 'A');
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    459, 'Customer 459', 'B');
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    516, 'Customer 516', 'C');
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    318, 'Customer 318', 'D');
    COMMIT;

  • I have an ipod nano and its fall down , the inside screen is broken..... can APPLE replace this(inside screen)???!

    i have an ipod nano and its fall down , the inside screen is broken..... can APPLE replace this(inside screen)???!

    Hello Alia A,
    Sorry to hear about your iPod nano screen.  I recommend reviewing the following link for service options (you can update the country selection to your location after accessing the link):
    Service Answer Center - iPod
    http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipod
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Can I write a SELECT query on maintenance view?

    Hi,
    Can we write a select query on maint. view? If not what are the views on which we can write the select queries?

    hi,
    you can write select query for maintenance view, database view and projection view but not helpview as it is only intended for f4 help.
    reward if helpful
    prasanth

  • Please explain this select query

    Hello Experts
    please see this select query.
      select  *  from kna1 where lifnr = '1111111101'.
    while debugging how to see what records this above select query has fetched. please explain me.
    Thanks for all the replies

    Hi madan,
    as explained, you need an ENDSELECT which I think you already have. In debugger, you could see the records fetched between SELECT and ENDSELECT but you will probably get a DUMP because a forbidden database access interrupt is detected.
    If your program does not process the records you have no chance to see them.
    A possible solution is:
    data:
      lt_kunnr type table of kna1-kunnr.
    select * from kna1 where lifnr = '1111111101'.
      append kna1-kunnr to lt_kunnr.
    endselect.
    Now you have the primary key KUNNR of all records fetched in table lt_kunnr.
    Regards,
    Clemens

  • HT1373 i have downloaded logic pro x from app store to my computer, can i transfer this to my bigger more powerful computer that doesnt use internet

    i have downloaded logic pro x from app store to my computer, can i transfer this to my bigger more powerful computer that doesnt use internet

    Welcome to Apple Support Communities
    Of course. If your other Mac is compatible with Logic Pro X, simply copy Logic Pro X from Applications folder to the external disk. Then, connect your external disk to the other computer, and move Logic Pro X to Applications folder.
    See > http://www.apple.com/logic-pro/specs

  • Make this select query to Select Insert query

    Hi,
    How to make this select query to select Insert query..
    ;WITH DateDim AS
    SELECT CAST('1900-01-01' AS DATETIME) StartDate
    UNION ALL
    SELECT StartDate + 1
    FROM DateDim
    WHERE StartDate + 1 <= '2099-12-31'
    SELECT CAST(CONVERT(CHAR(8),CAST(StartDate AS DATETIME),112) AS INT) AS DateKey
    , StartDate
    , DATEPART(dw, StartDate) AS DayNumberOfWeek
    , DATENAME(dw, StartDate) AS EnglishDayNameOfWeek
    , DAY(StartDate) AS DayNumberOfMonth
    , (CASE WHEN MONTH(StartDate)>=1 AND MONTH(StartDate) <=6 THEN 1 ELSE 2 END) AS CalendarSemester
    FROM DateDim 
    OPTION (MAXRECURSION 0) 
    GO

    The final solution is                            
     ;WITH DateDim AS
    SELECT CAST('1900-01-01' AS DATETIME) StartDate
    UNION ALL
    SELECT StartDate + 1
    FROM DateDim
    WHERE StartDate + 1 <= '2099-12-31'
    SELECT CAST(CONVERT(CHAR(8),CAST(StartDate AS DATETIME),112) AS INT) AS DateKey
    , StartDate
    , DATEPART(dw, StartDate) AS DayNumberOfWeek
    , DATENAME(dw, StartDate) AS EnglishDayNameOfWeek
    , DAY(StartDate) AS DayNumberOfMonth
    , (CASE WHEN MONTH(StartDate)>=1 AND MONTH(StartDate) <=6 THEN 1 ELSE 2 END) AS CalendarSemester
    Into new_tablenameFROM
    DateDim 
    OPTION (MAXRECURSION 0) 
    GO

  • My old MobileMe account surfaced when I was on a support call. I didn't discover it until the case was closed. How can I replace this obsolete account with my current iCloud account?

    My old MobileMe account surfaced when I was on a support call. I didn't discover it until the case was closed. How can I replace this obsolete account with my current iCloud account?

    Do you mean that you were using the Apple ID which is your ex-MobileMe address? It's still an Apple ID, even though MobileMe itself is dead, and there's nothing to stop you from using it as an ID with Support, or logging in here or in iTunes with it. You should make sure you have a functioning non-Apple email address associated with it.
    Did you migrate your MobileMe account to iCloud before 1 August last? If so, you can set up an iCloud account using it, or if you have already set up a new and separate iCloud account you can still log in with it in System Preferences>Mail, Contacts and Calendars so that it runs alongside your iCloud account.
    If you didn't migrate you can still reactivate the address the same way.
    Anything where you've logged in with the ex-MobileMe address, such as support for something you registered using it or a server such as iTunes, will need to continue using it.

  • System Preferences quits suddenly. I have lost the dock, including the trash and ability to change desktop image. How can I replace this part of System Preferences? Where can I find Trash?

    System Preferences quits suddenly. I have lost the dock, including the trash and ability to change desktop image. How can I replace this part of System Preferences? Where can I find Trash? All other aspects of System Preferences work.

    just that that is one method, and lacks provision for working boot image and for an emergency - Lion gives a small minimal emergency boot environment but may lack all the utilities you need to use and run, even some drivers that your mac requires for add on PCIe.
    Just grab and look through Help in Carbon Copy and SuperDuper, both excellent and each has their use - together - for cloning.
    And do you have two TM backup sets? ought to consider that also, rotate daily or make a weekly set. Otherwise you are putting all your eggs in the proverbial one basket.

  • Can any one send select query for this?

    Hi,
    can any one plese send select query for the following query.please send as early as possible.
    Loop through the I_BSID internal table to fill records in I_OUTPUT.Combine data from I_BSID, I_KNKK, I_KNKK_KNKLI, I_KNA1 and I_KNVV into I_OUTPUT based on the linking conditions .Field Description Source are
    I_OUTPUT-BUKRS     Company code     I_BSID-BUKRS
    I_OUTPUT-KUNNR     Customer number     I_BSID-KUNNR
    I_OUTPUT-NAME1     Customer Name     I_KNA1-NAME1
    I_OUTPUT-KNKLI     Credit account     I_KNKK-KNKLI
    I_OUTPUT-KDGRP     Customer Group     I_KNKK-KDGRP
    I_OUTPUT-KLIMK     Credit Limit     I_KNKK_KNKLI-KLIMK
    I_OUTPUT-KVGR1     Business Unit     I_KNVV-KVGR1
    I_OUTPUT-REBZG     Invoice Number     I_BSID-REBZG
    I_OUTPUT-BLDAT     Invoice Date     I_BSID-BLDAT
    I_OUTPUT-WAERS     Document Currency     I_BSID-WAERS
    I_OUTPUT-DUE_DATE     Due Date     Based on below
    Calculation
      Get the Payment terms days combining I_BSID and I_T052 based on the linking conditions mentioned above.    Note : a) Baseline Date : If baseline date I_BSID-ZFBDT is blank , use the Document Date.b) Payment Term Days :If I_BSID-ZBD3T is not blank, take this as Payment Term Days for Due date calculation.
                       If I_BSID-ZBD3T is Blank, then get payment term days from I_T052 based on I_BSID-ZTERM. If there are more than one record in I_T052 for the given Payment term, get the day part from baseline date and select the first record where the day limit I_T052-ZTAGG is greater than the day part.If I_BSID-ZBD3T is blank and I_BSID-ZTERM is also blank, then take Y000 (Due Immediately) as Payment term and proceed with the above logic. Set the payment term field blank while printing.
    Calculate Due date : For Debits, Determine Due Date = Baseline Date + Payment term Days(not discount days)                                                          For  Credits  Due date = Baseline date.Then, move the amount I_BSID-DMBTR to respective buckets (Not yet Due, Current Due, Past due 1-30, Past Due 31-60 etc.)  Based on the due date.
    Thanks&Regards,
    praveen kumar.A

    HI,
    To get Open Items you can use Function module:
    data:i_items TYPE STANDARD TABLE OF rfpos.
    CALL FUNCTION 'CUSTOMER_OPEN_ITEMS'
    EXPORTING
    bukrs = p_bukrs
    kunnr = wa_customer-kunnr
    TABLES
    t_postab = i_items
    EXCEPTIONS
    no_open_items = 1
    OTHERS = 2.
    Table I_items will have all the open items for that Customer in the given company code.
    Well for Clear Items: Try
    GET_CLEARED_ITEMS or FMITPOFM_CLEARED_ITEMS_GET.
    Hope it helps.
    Manish

  • Select query taking more time..

    Hi friends..
    The below inner join statement is taking more time ,  can any  body sugget me to improve the performance . I tried FOR ALL ENTRIES also but that also taking more time than inner join statement .
    SELECT a~vbeln from vbap as a inner join vakpa as b
          on avbeln = bvbeln
          into corresponding fields of table IT_VAKPA
          where a~WERKS IN S_IWERKS
          and a~pstyv NE 'ZRS'
          and b~vkorg = IVKORG
          and b~audat IN IAUDAT
          and b~vtweg IN IVTWEG.
    Regards
    Chetan

    Hi Chetan ,
    VAKPA is an index table. From the select query , it has been observed that you are not fetching any data from VAKPA. Only you have added some selection paramenters in where clause of select query.
    My suggestion will be instead of using VAKPA in inner join you use VBAK along with VBAP. All the fields that you are using as selection condition from VAKPA are there in VBAK.
    I am sure performance of query will be improved.
    If still duo to business logic you need to use VAKPA, try to create secondary non unique index on fields VKORD,AUDATand VTWEG on table VAKPA.
    However I will recommend you to go for first option only. If this does not work then go for second option.
    Hopfully this will help you.
    Regards,
    Nikhil

Maybe you are looking for