Select statements where we have to write in crm 7.0

hi
i am new to sap crm 7.0
1)where we are useing select statments in sap crm 7.0
where we have to write the code as a crm technical consultant
at which level genil or bol .if we write can u plz let me knw with clear answer.

Subhani,
Writing queries in CRM is always tricky. The question you have asked is very general, still i will try my hands on it for the larger benefit of the community.
One should avoid writing queries on UI layer - As a general practice writing queries on UI is not appreciated because it hampers performance to a large extent.
Use of standard FM instead of queries - There are several standard FM provided by SAP which serves most of the purpose for which queries may have to be written, they are written in a way so as to optimize the DB connect.
BOL/GenIL - Incase the interaction with the DB table is very frequent, Query must be written in BOL/GenIL layer, this is done in order to have a steady framework and avoid frequent DB connect.
If you have any specific query, feel free to post it but be more elaborative so that community members can help.
Regards,
Harshit Kumar

Similar Messages

  • Please look into this.. where i have to write at end of

    HI all ,
    i am getting this output in my report.
    the first column is the division (D.C) and the next couln is the no of consumer(no of business partner in a perticular dc (this is the count of dc))
    314200     0
    314201     1     
    334300     0
    i got the value of the first two digit of dc in a variable.
    now when it change from 31 to 33 i want to get the value of no of count .
    but the atatement AT END OF IS NOT WORKING ...
    Can anyone just look at the code and let me where i have to change..
    REPORT  ZDISTRICT_CUST_AUCSALES.
           LINE-COUNT 40(4).
    ******************************************************TABLE DECLARATION
    TABLES: /BIC/AUCSALES00,
            /BIC/TCOKEY.
    *******************************************************DATA DECLARATION
    DATA:  BEGIN OF ITAB OCCURS 0,
           /BIC/COKEY LIKE /BIC/TCOKEY-/BIC/COKEY,
           TXTSH      LIKE /BIC/TCOKEY-TXTSH,
           END OF ITAB.
    DATA:  BEGIN OF ITAB2 OCCURS 0,
           BILL_DATE   LIKE /BIC/AUCSALES00-BILL_DATE,
           /BIC/COKEY  LIKE /BIC/AUCSALES00-/BIC/COKEY,
           BPARTNER    LIKE /BIC/AUCSALES00-BPARTNER,
           END OF ITAB2.
    DATA:  COUNT TYPE I,
           COKEY TYPE I,
           COKEYNO(2) TYPE C,
           BILDT TYPE I.
    DATA: C TYPE I VALUE 2.
    *DATA: /BIC/COKEY TYPE /BIC/AUCSALES00-/BIC/COKEY.
    SELECT OPTION FOR DATE SELECTION IN THE SELECTION SCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK DATE WITH FRAME TITLE TEXT-001.
         SELECT-OPTIONS: S_BILDT FOR /BIC/AUCSALES00-BILL_DATE OBLIGATORY default sy-datum.
    SELECTION-SCREEN END OF BLOCK DATE.
    *********************************************************INITIALIZATION
    *INITIALIZATION.
    FORMAT INTENSIFIED ON COLOR = C.
    write:/  'PROCESSING DATE:',    20 SY-DATUM,
         125 'TIME           :',   130 SY-UZEIT.
    WRITE:/  'USER NAME      :',    20 SY-UNAME, 138 ' '.
    WRITE SY-ULINE.
    WRITE: / 'D.C'                   , 12 SY-VLINE,
             'NAME OF D.C'        , 36 SY-VLINE,
             'BILL DATE'             , 53 SY-VLINE,
             'NUMBER OF CONSUMER' , 74 SY-VLINE,
             'REMARKS'            ,105 SY-VLINE.
    write sy-uline.
    *ULINE AT (100).
    FORMAT INTENSIFIED OFF.
    *END-OF-PAGE.
    WRITE:/40 'PAGE NO:', SY-PAGNO.
    *****************************************************AT SELECTION-SCREEN
    SELECT BILL_DATE
           UP TO 1 ROWS
           INTO (/BIC/AUCSALES00-BILL_DATE)
           FROM /BIC/AUCSALES00
           WHERE BILL_DATE IN S_BILDT.
    ENDSELECT.
    IF SY-SUBRC <> 0.
          WRITE:/ ' NO DATA FOUND ON THIS DATE'.
          EXIT.
    ENDIF.
    START OF SELECTION
    SELECT /BIC/COKEY TXTSH from /BIC/TCOKEY into table itab.
    IF NOT ITAB[] IS INITIAL.
    SELECT  BILL_DATE
             /BIC/COKEY
             BPARTNER
             FROM /BIC/AUCSALES00
             INTO CORRESPONDING FIELDS OF TABLE ITAB2
             FOR ALL ENTRIES IN ITAB
             WHERE /BIC/COKEY = ITAB-/BIC/COKEY
             AND BILL_DATE IN S_BILDT.
    SORT ITAB BY /BIC/COKEY.
    ENDIF.
    ***********************CHECK WHETHER THE DATA RETRIVE SUCESSFULLY OR NOT
    IF SY-SUBRC NE 0.
      WRITE:/ 'THIS DATE DOESNOT CONTAIN ANY DATA'.
    ENDIF.
    ************************************************************DATA DISPLAY
    LOOP AT ITAB.
    MOVE: ITAB-/BIC/COKEY+4(2) to COKEYNO.
    READ TABLE ITAB2 WITH KEY /BIC/COKEY = itab-/BIC/COKEY.
    IF SY-SUBRC = 0.
           SORT ITAB2 BY /BIC/COKEY.
           DELETE ADJACENT DUPLICATES FROM ITAB2 COMPARING /BIC/COKEY.
    ENDIF.
    IF ITAB2-/BIC/COKEY = ITAB-/BIC/COKEY.
           SELECT COUNT( DISTINCT BPARTNER )
                  INTO COUNT
                  FROM /BIC/AUCSALES00
                  WHERE /BIC/COKEY = ITAB2-/BIC/COKEY and
                  BILL_DATE IN S_BILDT.
          COKEY = ITAB2-/BIC/COKEY.
          WRITE:/ ITAB2-/BIC/COKEY,             SY-VLINE,
               15 ITAB-TXTSH,                   SY-VLINE,
               42 ITAB2-BILL_DATE,              SY-VLINE,
               55 COUNT,                    74  SY-VLINE,
                  ' ',                     105  SY-VLINE.
          WRITE:/ SY-ULINE.
      ELSE.
         COKEY = ITAB-/BIC/COKEY.
         WRITE:/ ITAB-/BIC/COKEY,                SY-VLINE,
              15 ITAB-TXTSH,                     SY-VLINE,
              51 '0' ,                           SY-VLINE,
              55 'Not Processed',              74 SY-VLINE,
                 'Data Not extracted to BW', 105 SY-VLINE.
          WRITE:/ SY-ULINE.
    ENDIF.
    CLEAR: ITAB, ITAB2.
    ENDLOOP.
    thanks in advance..

    Hi
    In this case instead of using AT END OF just create temp. which will hold in it last value of dc,every loop run, check it with new value, if it not equal - get the desired value
    only condition - itab must be sorted
    temp = 'x'. -->you need to put the first value
    loop at itab.
    if temp <> COKEYNO.
    --->your actions to get your value
    endif.
    temp = COKEYNO.
    endloop.
    OR
    you can add one more field to itab (better first) with COKEYNO
    fill itab in this field and then
    loop at itab.
    at end of cokeyno.
    endloop.
    Regards
    Yossi

  • Select Statement -- Where Clause Execution Order

    What is the order of execution of the "AND" and "OR" in the WHERE clause of a Select statement?
    Are the "AND"'s executed from the top down, left to right? Is it the same for the "OR"'s execution?
    Thanks for any help...

    Not clear why you care. There is an order in which the optimizer parses the SQL (which may change from ver to ver), but this is a fairly quick operation. The order in which tables are visited and predicates evaluated is dependent on what the op[timizer does with the SQL.
    Ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Mysql select statement where = works and LIKE fails

    I am using Flash Builder 4. On the server side I use php and mysql. I created a php dataservice using FB4. My plan had been to allow users to enter a search term and query the database using a "LIKE" statement. FB4 created the php code that I simply modified changing the parameter name. The input parameter is a string.
    public function getT_caseByID($searchTerm) {
    $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title = ?)");
    $this->throwExceptionOnError();
    mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
    $this->throwExceptionOnError();
    mysqli_stmt_execute($stmt);
    $this->throwExceptionOnError();
    mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
    if(mysqli_stmt_fetch($stmt)) {
          return $row;
    } else {
          return null;
    A look at FB4 shows this code returns data.
    This code works fine but if I make the below change it fails, even when I use the wildcard %. the only change is "=" to "LIKE".
    public function getT_caseByID($searchTerm) {
    $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title LIKE ?)");
    $this->throwExceptionOnError();
    mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
    $this->throwExceptionOnError();
    mysqli_stmt_execute($stmt);
    $this->throwExceptionOnError();
    mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
    if(mysqli_stmt_fetch($stmt)) {
         return $row;
    } else {
         return null;
    A look into FB4 shows "void".
    Any help would be appreciated. I am using localhost on Apache Server on a development computer with Windows XP.

    correctio0n on the select statement
    select statement code*********
    select
        apspnr astspr aobjnr apspid
        bpsphi bposid
        caufnr cpspel
        dinact dstat
        eudate eusnam eutime "estat
       F~TXT04
        g~estat
        G~TXT04
        into corresponding fields of table itobj
        from proj as a
        inner join prps as b on apspnr = bpsphi
        inner join aufk as c on bpspnr = cpspel
        inner join jest as d on cobjnr = dobjnr
        inner join jcds as e on dobjnr = eobjnr
                             and dstat = estat
        inner join tj02t as f on estat = fistat
        inner join tj30t as g on astspr = gstsma
        for all entries in itparm
        where  apspid = itparm-pspid "or estat = itparm-psy )
        or  bposid = itparm-posid "or estat = itparm-wsy )
        or  caufnr = itparm-aufnr "or estat = itparm-nsy  )
        and ( dinact  'X' or einact  'X')
        and fspras = 'E' and gspras = 'E'.

  • Select statement - Where Condition not possible

    Hi,
    I am trying to extract data from sap standard table CFX_COL.I want extract based on a field which is of type string.I can see that in the table but when I code below I am getting error.Any other alterantives?
    REPORT x.
    TABLES:proj.
    DATA: it_proj TYPE STANDARD TABLE OF proj.
    DATA:wa_proj TYPE  proj.
    DATA: it_cfol TYPE STANDARD TABLE OF CFX_COL.
    DATA:wa_cfol TYPE  CFX_COL.
    data:v_name type STRING.
    PARAMETERS: p_pspid LIKE proj-pspid.
    SELECT * FROM proj INTO CORRESPONDING FIELDS OF TABLE it_proj
    WHERE pspid = p_pspid.
    READ TABLE it_proj INTO wa_proj INDEX 1.
    concatenate wa_proj-pspid '-' wa_proj-post1 into v_name.
    select * from CFX_COL into CORRESPONDING FIELDS OF TABLE it_cfol
    where name in v_name.
    Error:The Field "NAME"  is a long string , so it cannot be used in WHERE, ON or HAVING conditions.
    Rgds
    Vara

    Hi Vara.
    Select will not work if you are trying to search based on the name field as in the table  CFX_COL it has data type String which basically is not content but a reference to a storage area and internally it is stored in a different format not searchable. Even , if you try to find the number of entries in the table you can not put any value in this field as it will not be available for input as it doesn't contain any value.
    STRING: Character string with variable length This data type can only be used in types (data elements, structures, table types) and domains. In the Dictionary a length can be specified for this type (at least 256 characters). It may be used in database tables, however, only with restrictions. For a description of them refer to the documentation of the ABAP statement 'STRING' . In ABAP, this type is implemented as a reference to a storage area of variable size. As default for the output length 132 characters are proposed. You cannot attach search helps to components of this type.
    http://help.sap.com/saphelp_40b/helpdata/en/cf/21f2e5446011d189700000e8322d00/content.htm
    Regards
    Apoorva

  • Offset operation in select statements where clause

    dear experts,
        if i use offset operation in select query , syntactically giving
        me a warning message.
        how to avoid warning message
        without using another internal table populated with  only  jtab+0(10).  
       ex:
              select field1 field2
                        into table   itab
                        from ztable1
                        for all entries in jtab
                        where field =  jtab+0(10).
    thanks in advance.

    No need to populate another internal table...
    when populating jtab from database select ur field twice
    structure for jtab..
    types: begin of ty_jtab,
              field type ...
              field1 type char10,
            end of ty_jtab.
    populate the field twice..
       select ...
                 field
                 field
    into table jtab
    Now u can use the field field1 in the next select
    select field1 field2
    into table itab
    from ztable1
    for all entries in jtab
    where field = jtab-field1.

  • Select statement where column not equal to number

    Hi experts,
    I have a column amount
    id    amount
    1       123.0000000000
    2      33344.0000
    3      66666.36220000000000000000
    4       2122222.7878789799999
    5       444444444
    6       .000000000000000000000
    7        wweeeeeeeeeerr
    8       eeeeeeeeeeeeeet
    I want to get :
    id         amount
    7        wweeeeeeeeeerr
    8       eeeeeeeeeeeeeet Thanks in advance

    i am getting my amount from txt file
    Iam loading that into external files and then to the database tables
    intially i will get amount(it should have only numbers) as varchar2
    (But , when iam loading into tabes i will convert that into number using CAST function.)
    When loading , Iam getting invalid number error

  • Inner Join for Dynamic Select statement

    Hi All,
      Can some one please help me in rewriting the below select statement where i have to remove the existing table1 by putting a dynamic table name which has the same table structure.
      select a~zfield1
               a~zfield2
          from ztab1 as a
           inner join ztab2 as b
               on b~ztab1-zfield3 = a~ztab2-zfield3
         where a~zfield4 = 'A'.
    I am looking something as below. But encountering an error when using the below statement
      select a~zfield1
               a~zfield2
          from (v_ztab1) as a
           inner join ztab2 as b
               on b~ztab1-zfield3 = a~ztab2-zfield3
         where a~zfield4 = 'A'.
      No Separate selects please. Please help me in rewriting the same select statement itself.
    Regards,
    PSK

    hi,
    What error you are getting ?
    Also INTO is missing from the statement.
    SELECT  pcarrid pconnid ffldate bbookid
      INTO  TABLE itab
      FROM  ( spfli AS p
                INNER JOIN sflight AS f ON pcarrid = fcarrid AND
                                           pconnid = fconnid    )
      WHERE p~cityfrom = 'FRANKFURT' AND
            p~cityto   = 'NEW YORK' .
    thanks

  • How build where clause in select statement in FM for Virtual provider

    Hi
    I looking for example of FM for Virtual provider where I find code how assign to select statement "where" clause value from query variable.
    In following code how build t_r_custtype range and how assign value to it.
    CODE********************************
    TYPE-POOLS: abap.
    initialize
      CLEAR: e_t_data, e_t_msg.
    this is specific to infoprovider VIRTPROV
      CHECK i_infoprov = 'VIRTPROV'.
      FIELD-SYMBOLS: <l_s_sbook> TYPE sbook,
                     <l_s_data>  TYPE ANY.
      DATA: l_t_component TYPE abap_compdescr_tab,
            l_t_sbook     TYPE TABLE OF sbook.
    initialize
      CLEAR e_t_data.
    Data selection / only Business Customer
      SELECT * FROM sbook
        INTO CORRESPONDING FIELDS OF TABLE l_t_sbook
        WHERE custtype in t_r_custtype.
    ENDCODE********************************
    Thanks a lot
    Adam

    Hello,
    Would you like fill the ranges in Customer exit for BEx..? 
    If Yes. please refer the attachment for the whole code...
    "Sample code in Customer Exit in BEx"
    IF i_step = 2.
    CASE i_vnam.
    WHEN 'ZDAY_CX'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT2
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZLSDAY.
    E_TT =
    E_ULTKZ =
    l_s_range-low = ZFIDAY .
    l_s_range-high = ZLSDAY .
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    **To get the From date (For Text Variable) as per the user input date interval range**
    WHEN 'ZR_S'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = 0
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    l_s_range-low0(2) = ZFIDAY6(2).
    l_s_range-low+2(1) = '.'.
    l_s_range-low3(2) = ZFIDAY4(2).
    l_s_range-low+5(1) ='.'.
    l_s_range-low6(4) = ZFIDAY0(4).
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    Please let me know if any clarification required..
    Rinku..

  • Hint in Update or Select Statement in an inline query ??

    Hi ,
    I had an update statement that will get the data from the inline select statement,now where can i can keep the hint ,either in update statement or in Select statement...
    Please let me know if my sample script is wrong or any better way to approach...Please assume that Salary table had millions of employee's salary records.
    update emp
    set salary = salary + (select /*+ full(a) parallel(a,4)  */ salary from Salary
                             where   experience > 5  and empno = 55 )
    where empno = 85Thanks
    Rede

    You would put the hint in the select statement as you have it, but it won't work until you alias your table name to "a" since that is how you are referencing it in the hint:
    update emp
    set salary = salary + (select /*+ full(a) parallel(a,4)  */ salary from Salary a
                             where   experience > 5  and empno = 55 )
    where empno = 85
    NOTE I added the "a" right after the Salary table name AND you can only do parallel updates on partitioned table, but the select will run in parallel to at least get the data for you quickly.
    To answer your other question about syntax, it is incorrect and there are a lot of ways to write it but a straight forward way would be to use the merge statement
    merge into emp e
    using (select /*+ full(s) parallel(s,4)  */ s.salary from salary s where s.experience > 5) s
    on (e.empno = s.empno)
    when matched then update
    set salary = s.salary;

  • Consolidating the SELECT Statement --- ABAP

    Hi
    I have following query & calculation in part-1. I want to change part-1 so that i could achieve the same by Part-2. I know Part-2 is not syntactically good, but any suggestion how to make Part-1 as Part-2. Thanks...
    Part-1)
    SELECT Creation_Date
                 Rcvd_Date     
        FROM ZPURCHASE
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        UP TO 3 ROWS
        WHERE Customer  = '3000'
        ORDER BY Rcvd_Date DESCENDING.
        LOOP AT ITAB INTO WA.
          WRITE:/ WA-Creation_Date,
                  WA-Rcvd_Date.
        ENDLOOP.
       v_sumDays = 0.
       v_counter = 0.
       LOOP AT ITAB INTO WA.
          v_noOfDays = WA-Rcvd_Date - WA-Creation_Date.
          v_sumDays = v_sumDays + v_noOfDays.
          v_counter = v_counter + 1.
       ENDLOOP.
       v_leadTime = v_sumDays / v_counter.
    Part-2)
    SELECT SUM ( Creation_Date - Rcvd_Date     ) / COUNT(*)
        FROM ZPURCHASE
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        UP TO 3 ROWS
        WHERE Customer  = '3000'
        ORDER BY Rcvd_Date DESCENDING.

    Hi
    select creation_date Rcvd_date from ZPURCHASE into table itab up to 3 rows where Customer = 3000.
    v_sumDays = 0.
    v_counter = 0.
    loop at itab into wa sort by Rcvd_date descending.
    v_noOfDays = WA-Rcvd_Date - WA-Creation_Date.
    v_sumDays = v_sumDays + v_noOfDays.
    v_counter = v_counter + 1.
    ENDLOOP.
    I think you cannot do calculations in Select statement as you have declared in PART2.
    Aggregate functions can be performed on one field or cannot do calculation other than their own functionality.
    to achieve your requirement you need to do your own calculations, As you have done in your part1.
    Please check the above code its almost dimilar to your code
    But do not use move corresponding.
    hope it make you clear.
    Thanks
    Lalit Gupta

  • Writing Select statement for JDBC Adapter

    Dear frndz,
       Please guide me, i have to pick record form the Oracle D/B,
    and this has to be updated in the Sap Table. For this scenario, tell me where i have to write the select statements to fetch the particular record.I was asked to use the jdbc adapter for this d/b link.
    Thanks in advance
    Karthikeyan

    Hi karthikeyan,
    You have to use a sender JDBC adapter.
    Just follow the instructions in this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
    Previously, you must install Oracle drivers so that JDBC works properly.
    Regards,
    Carlos

  • Performance issue - Select statement

    Hi  I am having the 10 lack records in the KONP table . If i am trying to see all the records in SE11 , it is giving the short dump TSV_TNEW_PAGE_ALLOC_FAILED . I know this is because of less memory in the Server . Is there any other way to get the data ? How to optimise the below SELECT statement if i have large data in the table .
    i_condn_data - is having 8 lack records .
    SELECT knumh kznep valtg valdt zterm
            FROM konp
            INTO TABLE i_condn_data_b
            FOR ALL ENTRIES IN i_condn_data
            WHERE knumh = i_condn_data-knumh
            AND kschl = p_kschl.
    Please suggest .

    Hi,
    try to use "UP TO n ROWS" to control the quantity of selected data in each Loop step.
    Something like this:
    sort itab by itab-knumh.
    flag = 'X'.
    while flag = 'X'.
    SELECT knumh kznep valtg valdt zterm
    FROM konp
    INTO TABLE i_condn_data_b UP TO one_million ROWS
    WHERE knumh > new_value_for_selection
    AND kschl = p_kschl.
    describe table i_condn_data_b lines i.
    read table i_condn_data_b index i.
    new_value_for_selection = i_condn_data_b-knumh.
    *....your logic for table i_condn_data_b
    if  one_million  > i.
    clear flag.
    endif.
    endwhile.
    Regards

  • USING SUBQUERY IN SELECT STATEMENT

    I am looking at reusing the results of a first query in a second select statement.
    I have a first table "ACTIVE_FIELDS" in which I maintain the columns I want to query.
    Table name ACTIVE_FIELDS
    Field - Status
    CODE - ACTIVE
    DESCRIPTION - ACTIVE
    NAME - INACTIVE
    So I get the list of active fields by doing :
    SELECT FIELD FROM ACTIVE_FIELDS WHERE STATUS=ACTIVE
    It gives me : Code and Description.
    I have then a second table MATERIAL with 3 columns CODE, DESCRIPTION and NAME.
    I am looking at doing a query against MATERIAL table as follows
    SELECT (SELECT FIELD FROM ACTIVE_FIELDS WHERE STATUS=ACTIVE) from MATERIAL and I expect to only get columns CODE and DESCRIPTION in the result.
    If I want to add the NAME field in the result of my query, I just have to change status of NAME field in the eh ACTIVE_FIELDS table..
    Can anybody help me with the exact syntax, I must miss a function to convert the result of the first query..

    that data model looks suspiciously like an attribute-value generic model, thus the need for that funky sql.
    read this thread.
    Re: SIMPLE Database Design Problem !

  • How can I limit the number of rows returned by a select stat

    How can I limit the number of rows returned by a select
    statement. I have a query where I return the number of stores
    that are located in a given area.. I only want to return the
    first twenty-five stores. In some instances there may be over
    200 stores in a given location.
    I know is SQL 7 that I can set the pagesize to be 25....
    Anything similiar in Oracle 8i?
    null

    Debbie (guest) wrote:
    : Chad Nale (guest) wrote:
    : : How can I limit the number of rows returned by a select
    : : statement. I have a query where I return the number of
    : stores
    : : that are located in a given area.. I only want to return the
    : : first twenty-five stores. In some instances there may be
    : over
    : : 200 stores in a given location.
    : : I know is SQL 7 that I can set the pagesize to be 25....
    : : Anything similiar in Oracle 8i?
    : If you are in Sql*Plus, you could add the statement
    : WHERE rownum <= 25
    : Used together with an appropriate ORDER BY you
    : could get the first 25 stores.
    Watch out. ROWNUM is run before ORDER BY so this would only
    order the 25 selected
    null

Maybe you are looking for

  • Inserting clip into sequence: aspect ratio adjustments

    I just made this page Aspect Ratio Adjustments available to whoever is curious to know what is the rational behind the values of +Aspect Ratio+ and Scale evaluated by FCE whenever it inserts a clip into a sequence. This was inspired by Michael in his

  • Asset PO created by selecting Wrong asset master.

    Hi experts.....   we have a issue where our plants is our profitcenters. user had created a asset releated Purchase order for plant 1000(P.C 1000) by refering asset master releated to P.C 2000 in P.O, GRN, MIRO have done values have gone to PC 2000 i

  • Should final movie be created in Premiere?

    When I output a movie in AE, it creates very large files for short movies (6 minutes = ~1.5GB).   I don't get HD and there aren't as many adjustments as in Premiere.  Should I always output a lossless .mov file from AE and then create the final HD .m

  • Why does the "Add to Library" window crash when I try clicking it?

    Everytime I click "Add to Library" under the  "File" tab, the window in which I try adding my sound files crash. Please help me understand why this happens and what i should do when it does.

  • Slowing startup

    When my 17" late 2008 mbp (previous to design change) was new & for some time later it seemed very snappy and fast to startup and shutdown. It came with the custom order but standard apple 120GB SSD. While shutdown still seems snappy in about 3 secon