How can I use a where in Select clause?

How can I use a where in select clasue when the other part of the where I do not not.
I mean that
Select *
from mara
where MATNR = MT*
That means it can have MTA, MTB, MTC....and so on
I can I write this code.
Regards,
Subhasish

hiii
you can use following query
SELECT * FORM mara WHERE matnr CONTAINING 'MT'
or use following
select * from mara WHERE matnr =  'MT%'
reward if useful
thx
twinkal

Similar Messages

  • How can i use SUM aggregate in select query?

    HI,
    GURUS,
    How can i use SUM function in Select Query and i want to store that value into itab.
    for ex:
    TABLES: vbap.
    types: begin of ty_vbap,
           incluse type vbap,
           sum type string,
          end of ty_vbap.
    data: i_vbap type TABLE OF ty_vbap,
          w_vbap type ty_vbap.
    SELECT sum(posnr) FROM vbap into table i_vbap up to 5 rows.
                            (or)
    SELECT sum(posnr) FROM vbap into table i_vbap group by vbeln.
      loop at i_vbap into w_vbap
    " which variable have to use to display summed value.
      endloop.
    if above code is not understandable pleas give ome sample code on  above query.
    Thank u,
    shabeer ahmed.

    Hi,
    Check this sample code.
    TABLES SBOOK.
    DATA:  COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
    DATA:  CONNID LIKE SBOOK-CONNID.
    SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
           INTO (CONNID, COUNT, SUM, AVG)
           FROM SBOOK
           WHERE
             CARRID   = 'LH '      AND
             FLDATE   = '19950228'
           GROUP BY CONNID.
      WRITE: / CONNID, COUNT, SUM, AVG.
    ENDSELECT.
    Regards,
    Sravanthi

  • How can we use list box on selection screen

    hi, howe can we use list box on selection screen and how can we populate the dat ainto the list box and how can we retrive data based on list box from ther database.
    thanks in advance
    raju

    Use the VRM_SET_VALUES function module.
    DATA: list              TYPE vrm_values,
          value             LIKE LINE OF list.
               AT SELECTION SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      name = 'P_OBJECT'.
      CLEAR list.
      REFRESH list.
      CLEAR value.
      value-key = '1'.
      value-text = 'Development Class'.
      APPEND value TO list.
      CLEAR value.
      value-key = '2'.
      value-text = 'Program'.
      APPEND value TO list.
      CLEAR value.
      value-key = '3'.
      value-text = 'Function Module'.
      APPEND value TO list.
      CLEAR value.
      value-key = '4'.
      value-text = 'Database Table'.
      APPEND value TO list.
      CLEAR value.
      value-key = '5'.
      value-text = 'Structure'.
      APPEND value TO list.
      CLEAR value.
      value-key = '6'.
      value-text = 'View'.
      APPEND value TO list.
      CLEAR value.
      value-key = '7'.
      value-text = 'Data Element'.
      APPEND value TO list.
      CLEAR value.
      value-key = '8'.
      value-text = 'Table Type'.
      APPEND value TO list.
      CLEAR value.
      value-key = '9'.
      value-text = 'Class / Interface'.
      APPEND value TO list.
      CLEAR value.
      value-key = '10'.
      value-text = 'Type Group'.
      APPEND value TO list.
      CLEAR value.
      value-key = '11'.
      value-text = 'Domain'.
      APPEND value TO list.
      CLEAR value.
      value-key = '12'.
      value-text = 'Search Help'.
      APPEND value TO list.
      CLEAR value.
      value-key = '13'.
      value-text = 'Lock Object'.
      APPEND value TO list.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = name
          values          = list
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • How can i use param in my select query ( see code)

    Hi ,
    I need to use the param instead of hardcoding the value in the select query , when i did that it is working .
    I think the limit of args is only till the end of main and my select query is in a method called Load() .
    How can i use the param in my select query .
    public static void main(String[] args){
    name = args[0];
    class= args[1];
    new Load();
    }//end of main
    public Load()
              try {
                   Class.forName(JDBC_DRIVER);
                   connection = DriverManager.getConnection(DATABASE_URL,"username","pw");
                   statement = connection.createStatement();
                   //First Query : pin and ticket number
                   ResultSet resultSet = statement.executeQuery("SELECT pin , ticketnumber from airport ,year where "+                                                                      "year.year_name= Here i need to use the param (instead of hardcoding) and year.class_year= Here too i need to use param");
    }// end of method Load()Edited by: 1sai on Sep 24, 2008 7:34 AM
    Edited by: 1sai on Sep 24, 2008 7:35 AM

    Might I suggest you change the structure of your program to the following:
    public class Load {
      private Connection conn;
      private PreparedStatement statement;
      public Load(String sql) {
        init(sql);
      protected void init(String sql) throws Exception {
        Class.forName(JDBC_DRIVER);
        conn = DriverManager.getConnection(DATABASE_URL, "username", "pw");
        statement = conn.prepareStatement(sql);
      public ResultSet execute(String p1, String p2) throws Exception {
        statement.setString(1, p1);
        statement.setString(2, p2);
        return statement.executeQuery();
      public void close() throws Exception {
        if (statement != null)
          statement.close();
        statement = null;
        if (conn != null)
          conn.close();
        conn = null;
      public static void main(String[] args) throws Exception {
        String sql = args[0];
        String param1 = args[1];
        String param2 = args[2];
        Load load = new Load(sql);
        ResultSet rs = load.execute(param1, param2);
        while (rs.next())
          System.out.println(rs.get(0));
        rs.close();
        load.close();
    }This allows you to use the same "Load" object for multiple queries with different parameters.
    I do not recommend you actually use the code above in any sort of production application. You should really take a look at Spring Framework along with an ORM tool like Hibernate or Ibatis to simplify your DAO layer.
    Hope this helps,
    David

  • How can i use index in select query.. facing problem with the select query.

    Hi Friends,
    I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
    Here is the query:
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelat LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelatrprctr
        WHERE rldnr  = c_telstra_accounting
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          And rzzlstar in r_lstar                            
          AND rpmax  = c_max_period.
    There are 5 indices present for Table ZTFTELAT.
    Indices of ZTFTELAT:
      Name   Description                                               
      0        Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)                                          
      005    Profit (RCLNT,RPRCTR)
      1        Ledger, company code, account (RLDNR,RBUKRS, RACCT)                                
      2        Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)                           
      3        Account, cost center (RACCT,RCNTR)                                        
      4        RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR                        
      Z01    Activity Type, Account (RZZLSTAR,RACCT)                                        
      Z02    RYEAR-RBUKRS- RZZZBER-RLDNR       
    Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
    Thanks in advance.

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • How can you add a where clause using "OR" with applied ViewCriteria?

    [JDeveloper 10.1.3 SU4]
    [JHeadstart 10.1.3 build 78]
    I am using JHeadstart, but have a question probably more in the ADF area. On the JHeadstart forum I asked:
    "I am overriding JhsApplicationModule's advancedSearch in order to be able to search in childtables. I created transient attributes, display those in advanced search and in the overridden method I check if any of these are filled by the user and create a where clause like 'EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>)'. I add this whereclause using ViewObject.setWhereClause.
    So far so good and it works. However, if the user selects 'Result matches any criteria', combining setWhereClause and the normal advancedSearch QueryByExample implementation using ViewCriteriaRow do not provide the desired result, since the ViewCriteria and the setWhereClause are AND-ed together, which is fine if the user selects the (default) "Results match all criteria" (everything is AND-ed) but not the "Result matches any criteria", since then every criterium is OR-ed together, except for the setwhereclause criteria and the set of ViewCriteriaRows, they are AND-ed.
    I looked if I could specify that a WhereClause will be OR-ed to existing applied ViewCriteria, but no luck. Do I have to rewrite also advancedSearch's ViewCriteria implementation and write an entire setWhereClause implementation to be able to "OR" every criterium? Or any other suggestions? Can I look at the entire Where clause and rewrite it (after applyCriteria and setWhereClause are called on the VO)?
    Toine"
    Sandra Muller (JHeadstart Team) told me today: "This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. The question is: how can you add a where clause using "OR" if there are already one or more ViewCriteria applied?
    To simplify the test case, you could create a simple ADF BC test client class in a test Model project without JHeadstart (in the test class, use bc4jclient + Ctrl-Enter), in which you first apply a few ViewCriteriaRows to a View Object and also add a where clause.
    Can you please log a TAR at MetaLink ( http://metalink.oracle.com/ ), or ask this question at the JDeveloper forum at http://otn.oracle.com/discussionforums/jdev.html ? (This what I am doing now ;-))
    Thanks,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting"
    Anyone knowing the answer or am I asking for an enhancement?
    Toine

    Hi,
    Can you SET your whereclause as follows ?
    ('Y' = <isAnd>
    and EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>))
    OR ('N' = <isAnd>
    AND EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> OR <another column in childtable> LIKE '<value supplied by user>))
    )

  • How can i use another icloud account in my iphone? can i pay one?? where?

    how can i use another icloud account in my iphone? can i pay one?? where?
    My phone has reached the maximum number of free accounts activated where can I buy one to use?

    You can't buy another one.  You have to reuse one of the accounts previously set up on your phone, or create a new one to use on another iOS device (running iOS 5 or higher) or Mac (running OS X 10.7.2 or higher), if you have one.

  • How can you change your line access selection?  I have found where you can change your plan selection, but can you change the line access fee or is that a set amount?

    How can you change your line access selection?  I have found where you can change your plan selection, but can you change the line access fee or is that a set amount?

        DIVAB71,
    Great question. The line access fees for the account are a set amount and can not be changed unless you are going from a basic to a smartphone or vice versa. If you are wondering about adding the month to month discount if you are out of contract Ann154 has provided great information on how to access and add the feature.
    LindseyT_VZW
    Follow us on Twitter @VZWSupport

  • How can I use "Free Selection" in Dunning?

    Hi,
    I am trying to generate the Dunning notice for only Customers that have the Dunning Area Code as 01. For that I am using the 'Free Selection". I have selected the Customer master and then the dunning area and didn't checked the Exclude box and then in  "Values" I have mentioned the Dunning Area Code as 01. But, System is not picking it up so what shall I do. Also, I have some questions in mind:
    1) Why there are two sections of 'Values" field?
    2) What is the process or steps to 'Exclude' the data?
    3) How can I use Dunning groups?
    Please Help.
    Thanks in advance...
    Regards
    Nitin

    Thanks done...
    Regards
    Nitin

  • Mi Iphone 4s is unlocked to use in Chine where i boght it but i can not use in England. All companies sed me that it is locked. How can i use whith a sim card of UK?

    mi Iphone 4s is unlocked to use in Chine where i boght it but i can not use in England. All companies sed me that it is locked. How can i use whith a sim card of UK?

    You cannot use a UK carrier sim in Chile unless you are a UK customer and have roaming set up with the UK carrier and the Chinease carriers do not offer unlocking so I doubt the iphone is unlocked

  • How can I use firefox between windows 7 & windows XP on a network, where we are using Samba server. If a user logs on different workstation(and OS) with same account.

    we have a Linux fileserver with Samba share and have several users.
    The users tend to be in different locations and need to login at different workstations, sometimes the workstation may be WindowsXP and othertimes it is windows7.
    How can we use Firefox & Thunderbird in this situation.
    I find that Windows7 uses compressed files to store the location information.
    when a user logs on to win7 it creates a new account.

    we have a Linux fileserver with Samba share and have several users.
    The users tend to be in different locations and need to login at different workstations, sometimes the workstation may be WindowsXP and othertimes it is windows7.
    How can we use Firefox & Thunderbird in this situation.
    I find that Windows7 uses compressed files to store the location information.
    when a user logs on to win7 it creates a new account.

  • How can you use the ipad with lectures in uni where i can annotate my notes?

    How can i use my ipad fpr lectures in uni?

    There are tons of note taking apps. If you want one that records lectures, take a look at Auditorium.

  • How can i use one SQL statement to solve problem?

    How can i use one SQL statement to solve the question below?
    For a Table named A, there is a column named F(char type).
    Now select all the records where F like '%00' and update their F value to '%01'
    Just one SQL statement.Do not use PL/SQL block.
    How to do that?
    Thanks.

    What is the data volume for this table?
    Do you expect lots of rows to have '%00' as their value?
    Following two statements come to mind. Other experts would be able to provide better alternatives:
    If you have index on SUBSTR(f, 2):
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) || '01'
    WHERE  substr(f,
                  -2) = '00';If most of the rows have pattern '%00':
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) ||
               DECODE(SUBSTR(f,
                             -2),
                      '00',
                      '01',
                      SUBSTR(f,
                             -2));

  • How can I use comma in the return values of a static list of values

    Hi all,
    I want to create a select list (static LOV) like the following:
    Display Value / Return Value
    both are "Y" / 'YY'
    one is "Y" / 'YN','NY'
    I write the List of values definition is like this:
    STATIC:both are "Y"; 'YY',one is "Y";'YN', 'NY'
    However, it is explain by htmldb like this:
    Display Value / Return Value
    both are "Y" / 'YY'
    one is "Y" / 'YN'
    / 'NY'
    I tried using "\" before the ",", or using single or double quote, but all these do not work:(
    How can I use a comma in the return values?
    Thanks very much!

    "Better still, why not process the code of both Y with 2Y and one is Y with 1Y? "
    Could you please explain in detail? thanks! I am quite new to htmldb
    In fact I have a table which has too columns "a1" and "a2", both the values of these two columns are "Y" or "N". AndI want to choose the records that both a1 and a2 are "Y", or just one of a1, a2 is "Y".
    So I write the report sql like this:
    "select * from t1 where a1 || a2 in(:MYSELECTLIST) "
    Thus, I need to use "," in the LOV, since expression list in IN(,,,) using ",".
    Any other way to implement this?

  • How can i use Button in BEx  7.0

    Dear Folks,
    Could you help me please ..
    In BI 7.0, for BEx analyzer i see we can use button, combo box, analysis grid.
    If i have a requirement like this:
    1. I have sales report, where it has information about sales person.
    2. And i want to filter that report with the sales person that i choose from combo box.
    For that requirement, i tried to :
    1. I Create a query to Sales info-provider for displaying sales.
    2. I Create a query to either to MD Sales person / Sales info-provider in order to get Sales persons data.
    3. I assign point no 1 to Analysis Grid.
    4. I assign point no 2 to Combo box.
    My questions are:
    a. Is my techniques correct ??
    b. How can i use button to execute filter into the corresponding report ???
    c. Is there any tutorial regarding this ?? Could you share it to me please ..
    Really need your guidances..
    regards,
    Niel..

    Hi Niel,
    You can use the method you specified.
    In Bex Analyzer you have design mode where you can have the following items Button, Analysis Grid and Combo box.
    To work with the button you need to use the Command Wizard which consists of pre-defined functions, out of those select the one which suits your requirement and supply the parameters. As it is done thorugh a Wizard it would be easy to do.
    Also,
    The Button Name displays the name of the button, which is generated automatically and is unique. This name is used on the BEx Analyzer Design Toolbar menu to refer to a particular instance of the button.
    · Range u2013 Manipulate coordinates for a cell or cells in this field to move or resize the button.
    · Button Text - The text (caption) you want to display on the button. You can use this to describe the command the button executes.
    · Command Range (optional) - Specify a three-column range of cells in the worksheet that contains command parameters. In these cells, you provide the same parameters (Name, Index, and Value) as in the Static Parameters, but in the worksheet these can be variable, changing during
    navigation based on query results or on a value you manually specify.
    Button in Bex analyzer
    Regards,
    Neelesh Jain.

Maybe you are looking for

  • After Effects CC really slow in response

    Hallo and sorry for may bad english! So,my nightmares with CC continues! I have serious lag when i do almost everything in AE. Press CTRL+Z i have to wait,press CTRL+A...wait...press P...wait....press the spacebar for move the preview window...wait f

  • Have a number badge in settings that won't go away and there are no updates that need to be done.  Help!!!

    On my settings, there is a number one (red) that won't go away.  There are no updates that need to be done.

  • Maps problem on n85

    Hi. Due to constant disappearance of my phone memory, I did a hard reset on my handset but I cannot get my nokia maps working anymore. Every time I try to open it I get a mesage saying that it "failed to open app. Please download the latest version f

  • Cannot create ASM disk groups in DBCA - Oracle 11gR1, Windows 32bit

    Good afternoon, Using 11gR1 on Windows XP, I need help installing a database (single instance) using ASM, I am not able to select disks to be stamped for use by ASM. I have done the following steps: 1. Installed the Oracle 11gR1 software (no database

  • IMovie changes the background on my logo

    I am creating a movie in iMovie and am attempting to upload my company logo. On our logo the background is white. I have uploaded the logo in a jpeg format into iphoto. I then imported that format into my iMovie. However when I add it to my iMovie, i