Query with not like

Hi,
I am strugling with a query to display only Production Order in which there is lack of item '05.%'...
Is there a way to achieve only such Production Orders list ?
Any help would be appreciated.
Thank you,
Tomasz

ok, maybe I'll give the example as I don't know the solution:
SELECT T0.[DocNum], T0.[ItemCode], T0.[Status], T0.[Type], T0.[PlannedQty], T1.[ItemCode]
FROM OWOR T0  INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.[ItemCode] not like '05.%'
as result I see Production Orders, when I enter some of these documents I see they have '05.%' item in line, the question is how to list only the documents without '05.%' item.
Thank you,
Tomasz

Similar Messages

  • Performance issue with NOT LIKE 'VA%' in Sql Query

    I'm fetching vendor details from po_vendor_sites_all , in the where clause i use vendor_site_code NOT LIKE 'VA%'. Database:10g
    NOT LIKE is reducing the performance, any other option to increase the performance.
    Any suggestions?
    Thanks
    dow005

    Assuming a fairly even distribution of vendor_site_codes and assuming a LIKE 'VA%'
    would pick up 1% of the rows and assuming an index on vendor_site_codes
    and a reasonable clustering we might expect that query to use an index.
    Your query is NOT LIKE 'VA%' which implies picking up 99% of the rows = Full table scan.
    The only option I can think of is to use parallelism in your query (if the system has the
    power to handle it) or perhaps use more where clause restrictions on indexed column(s)
    to reduce the number of rows picked up.
    I've had to assume a lot of things as you don't give any info about the table and data.
    If you could provide more information we might be able to help more.
    See SQL and PL/SQL FAQ
    Edited by: Paul Horth on 02-May-2012 07:12

  • Not able to migrate a query with not exist clause

    Hi all,
    I'm using Toplink 10.1.3 and I am trying to rewrite the following query with Expression Framework:
    select distinct r.e_ogg_oper_k_oggetto
    FROM regola_accettazione_oper_banc r, oggetto_operazione_bancaria o
    where not exists (
    select 1
    FROM limitaz_ogg_tipo_oper_banc l
    where nvl(l.d_fine_validita,trunc(sysdate)+1)>trunc(sysdate)
    and l.d_inizio_validita <= trunc(sysdate)
    and l.e_tpodv_k_tipo_operazione=:appoggio.tipo_operaz
    and l.e_ogg_oper_k_oggetto=r.e_ogg_oper_k_oggetto
    and l.e_uni_oper_k_unita_oper_util= :appoggio.e_uni_oper_k_unita_oper_esegui )
    and r.e_oper_ban_k_operaz_bancaria=:appoggio.form
    and r.e_ogg_oper_k_oggetto=o.k_oggetto
    and o.e_ogg_oper_k_oggetto is null
    and o.k_oggetto != nvl(:appoggio.oggetto_autom,,'0')
    and o.k_oggetto like substr(:appoggio.oggetto,1,2)||'%'
    and r.d_inizio_validita <= :appoggio.d_contab
    and to_date(nvl(to_char(r.d_fine_validita,DD/MM/YYYY'),31/12/3999'),'DD/MM/YYYY')> :appoggio.d_contab
    and o.f_natura_oggetto in ('G','P') and r.f_oggetto_automatizzato!='S'
    I'm not able to "attach" the not exist clause to the rest of query.
    How can I do it?
    Thank you very much.

    Not exists can be used in an expression through using a ReportQuery sub-query.
    i.e.
    ExpressionBuilder outerBuilder = new ExpressionBuilder();
    ReadAllQuery outerQuery = new ReadAllQuery(Employee.class, outerBuilder);
    ExpressionBuilder subBuilder = new ExpressionBuilder();
    ReportQuery subQuery = new ReportQuery(Address.class, subBuilder);
    subQuery.addAttribute("id");
    subQuery.setSelectionCriteria(
    subBuilder.get("city").equal(outerBuilder.get("address").get("city")
    .and(subBuilder.notEqual(outerBuilder.get("address")))));
    outerQuery.setSelectionCriteria(
    outerBuilder.notExists(subQuery));
    List results = (List) session.executeQuery(outerQuery);
    Refer to the documentation section on sub-queries for more information.
    I would suggest simlpifying the where clause until you get the sub-query working to start.
    You can also always use a custom SQL query in TopLink.

  • Query with "not in" no longer working

    I created a query to show customers that had not been contacted (i.e.- did not have an activity) in B-one in the last 30 days so the salespeople could do follow up. they started using activities in January and now here in May-something is amiss.
    Now after working for a while, it doesn't seem to be working.  It doesn't work for 30 days but does for 10 or 11 days specification.  There are a lot more activities now and i wonder if this is playing a part in it.  no chagnes or updates were made.
    i ran the query in management studio and got the same failing results. here is the query:
    SELECT T0.[CardCode], T0.[CardName], T0.[Phone1], T0.[CntctPrsn], T0.[E_Mail], T0.[SlpCode], T0.[CardType] FROM OCRD T0 WHERE  (T0.[Cardtype]<> 'S' ) and
    (t0.[cardcode] not in (Select t3.[cardcode] from OCLG t3 where t3.[recontact] >= getdate() -30))
    An example is i have customer A has activities dated 2/2/11, 2/18/11, 3/20/11, 4/5/11, and 4/6/11. doesn't matter if closed or open activity.
    30 days from today would be 4/10/11 so customer A should show up in query list ....now NO customers at all show up. If I change the 30 in the GetDate line to 10 or 11, it does give me records.  But at 12, it doesn't.
    Any thoughts- appreciatively,.
    laura

    Hi,
    Try to break query first
    run below query first
    (Select t3.cardcode from OCLG t3 where t3.recontact >= getdate() -30)
    Thanks
    Kevin

  • Results in the query are not like the one in the cube

    Hello there,
    I have a problem. when I execute a query, and see the results, it doesn't match. The query calculates some things. I have a sort of formula, when I execute it on database level I get a other result and when I execute on query level I get other results. The problem is that the wrong results that I get, is for a couple of days. only couple of days are wrong. Where should I search because I don't know it anymore.

    Hi
    Check the data of your cube from LISTCUBE TCode. And then apply the formula (what you have applied at the query level) on the Cube data.
    And then compare the data if it is matching.
    And if you find that data in Cube is wrong then you will have to hig in to its source data.
    Regards
    Rohini

  • How create a variable with not like 'Virtual'

    I'm creating a report and my requirement is to select all plant names wich does not have 'VIRTUAL' word in the name. Can you tell me how to do this?
    Can you tell me how to create a variable and what to have in it?
    Thanks,
    PV

    Dear P V,
    The variable processing types are,
    1)Manual Entry/Default Value
    2)Replacement Path
    3)Customer Exit
    4)SAP Exit
    5)Authorizations
    OverView
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/579b3c494d8e15e10000000a114084/frameset.htm
    Check this Link for more
    http://help.sap.com/saphelp_nw04s/helpdata/en/61/579b3c494d8e15e10000000a114084/frameset.htm
    Check this for Replacement Path,
    http://www.sd-solutions.com/documents/SDS_BW_Replacement
    http://help.sap.com/saphelp_nw04/helpdata/en/ca/5f9ac61a205a459d0e7ef313d10321/frameset.htm
    You can find details about variables here:
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56a7e09411d2acb90000e829fbfe/content.htm
    You can see the following link for details on processing types .
    http://help.sap.com/saphelp_nw04/helpdata/en/61/579b3c494d8e15e10000000a114084/content.htm
    see the below links u can find examples as wel as good stuff
    http://help.sap.com/saphelp_nw04/helpdata/en/5c/8db07d555411d189660000e829fbbd/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    replacement path
    variables
    Hope it helps
    regards
    bala

  • BDC select query with addition based on all If conditions

    Hi can any one send me the select query with conditions like
    If Itab is not initial.
    Endif. and if possible with valiadations messages also.
    IF CHECK_NUMBER of CHECK_ADVICE of the flat file = PAYR-CHECT. Then update SAP field BSEG-XREF2 .
    9.     When Flat file check Number = PAYR-CHECT then Insert or Update Flat file RECEIPT_DATE into SAP field BSEG-XREF1.
    Please send me immediately.

    >     SELECT rsnum
    >            rspos
    >            matnr
    >            werks
    >         lgort
    >            shkzg
    >            aufnr
    >            bdmng
    >            enmng                      
    >            FROM  resb INTO  TABLE it_rsnum FOR ALL ENTRIES IN it_aufnr
    >            WHERE rsnum EQ it_aufnr-rsnum
    >            AND   xloek NE 'X'
    >            AND   postp NE 'X'
    >            AND   resbbdmng GE resbenmng.
    >   ENDIF.
    >
    > Database Table RESB: 40,000,000 Records (40 Million)
    > Internal Table   it_aufnr:  20,000 Entries
    > Entries selected from RESB: 150,000.
    >
    Hi,
    the problem is the big for all entries table.
    Your 20.000 records FAE will be split into SEVERAL sql statements depending on the size of the table.
    Where do you get the it_auftrn from?
    If it's another transparent table try to JOIN this table to your big table.
    SELECT rsnum
                rspos
                matnr
                werks
            lgort
                shkzg
                aufnr
                bdmng
                enmng                      
                FROM  resb JOIN tab_auftrn  on  resbrsnum = tab_auftrnauftrn
                AND   xloek NE 'X'
                AND   postp NE 'X'
                AND   resbbdmng GE resbenmng.
    Make sure that your WHERE filter and the JOIN keys on both tables are supported by indexes.
    150.000 records about of 40 Mio. can definitly be serviced by an appropriate index:
    i.e. Index fields (check your PK or secondary indexes):
    rsnum
    enmng                      
    aufnr
    bye
    yk

  • Copy function based on the query with variables

    Hello
    Let me share the scenario I need to implement. I have a planning query with layout like shop / material / sales volume. The variables are shop number and calendar month. User opens the planning query, selects shop number and month, then sees the list of materials and puts the planned sales volume, then saves as a temporary version. Saving as a temporary version is realized by standard u201Csaveu201D function. The matter is that the user needs to have a possibility to copy this version to official one. I created the button and linked it with the copy function. The problem is that when a user clicks this button, the function asks him/her to provide variables again. I would like to have the button which copies the data with the same selection criteria as the query already has.
    Any idea?
    Arelis.

    Hi,
    I think when you add the button you specify the planning sequence name and that takes the filter of the modeler .Now when you try to call the planning sequence the filter variables are also added to the button as VAR_NAME, VAR_VALUE which prompts you for the variable again.Delete VAR_NAME,VAR_VALUE at the back of the button  manually and then save your work book.Then it will not ask for variable entry and the values that you have specified in the query filter will pass on to modeler filters.As variables are global.
    Similarly if you are using planning function then at the back of the button remove the VAR_NAME,VAR_VALUE.
    Hope this may help.
    Regards,
    Indu

  • How can I evaluate the count of a query I'd like to execute with a map...

    Hi. I have a problem with a query...
    I hava created a query which a execute with a Map (I use the
    executeWithMap(Map) method). The problem is that sometimes this query
    returns a large resultset. So, I would like to execute an other query
    (called query_count) before executing ther final query with the Map. If
    the query_count returns a count < 200, I execute the final query. How can
    I do ? There is an example I have read this in the documentation :
    Query query = pm.newQuery (Magazine.class, "price < 5");
    query.setResult ("count(this)");
    Long count = (Long) query.execute ();
    The problem in this example is that the query is not execute with a Map.
    So my question is : "How can we do the evalute the count of a query we
    would like to execute with a map ?". Thank you for any response.

    Hi John,
    You should be able to executeWithMap that query, too. Is that giving you
    problems?
    Note that there may be an easier solution. What do you do if there are more
    than 200 results? If, e.g., you just get the first N, then one option is to
    set the FetchBatchSize on the query to N (thus activating large result set
    support), and then call size () on the resulting Collection. This will
    issue a SELECT COUNT(*) to the database to determine the size automatically.
    Thanks,
    Greg
    "John" <[email protected]> wrote in message
    news:ctq9a8$4gr$[email protected]..
    >
    Hi. I have a problem with a query...
    I hava created a query which a execute with a Map (I use the
    executeWithMap(Map) method). The problem is that sometimes this query
    returns a large resultset. So, I would like to execute an other query
    (called query_count) before executing ther final query with the Map. If
    the query_count returns a count < 200, I execute the final query. How can
    I do ? There is an example I have read this in the documentation :
    Query query = pm.newQuery (Magazine.class, "price < 5");
    query.setResult ("count(this)");
    Long count = (Long) query.execute ();
    The problem in this example is that the query is not execute with a Map.
    So my question is : "How can we do the evalute the count of a query we
    would like to execute with a map ?". Thank you for any response.

  • Wrong result for query with like and %

    I have a strange problem with query with like and %.
    When I run this script:
    ALTER SESSION SET NLS_SORT = 'BINARY_CI';
    ALTER SESSION SET NLS_COMP = 'LINGUISTIC';
    -- SELECT * FROM NLS_SESSION_PARAMETERS;
    -- drop table test1;
    CREATE TABLE TEST1(K1 NVARCHAR2(80));
    INSERT INTO TEST1 VALUES ('gsdk');
    INSERT INTO TEST1 VALUES ('ąxyz');
    INSERT INTO TEST1 VALUES ('ŁFa');
    INSERT INTO TEST1 VALUES ('ła');
    INSERT INTO TEST1 VALUES ('Śab');
    INSERT INTO TEST1 VALUES ('Śrrrb');
    commit;
    select * from TEST1 where k1 like N'Ł%';
    I get this:
    K1
    ŁFa
    ła
    Śab <- WRONG
    Śrrrb <- WRONG
    4 rows selected
    When i change datatype to varchar2 this code work correct.
    Is this a bug or what ?
    The execution plan:
    PLAN_TABLE_OUTPUT
    SQL_ID d3d64aupz4bb5, child number 2
    select * from TEST1 where k1 like N'Ł%'
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 2 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 1 | 82 | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter((NLSSORT("K1",'nls_sort=''BINARY_CI''')>=HEXTORAW('014200'
    ) AND NLSSORT("K1",'nls_sort=''BINARY_CI''')<HEXTORAW('01610100') ))
    Note
    - dynamic sampling used for this statement (level=2)

    DATABASE NLS CONFIGURATION:
    NLS_CHARACTERSET AL32UTF8
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_COMP     BINARY
    NLS_SORT     BINARY
    Oracle version 11.2.0.2.0

  • Like Query with Case insensitive

    Hi ,
    I have select query with Like, need to add case insenstive for that.
    E.g
    Select * from emp where empname like ('D%').
    The above query will fetch only names starting with 'D' not the name starting with 'd'.But i need to fetch all the name starting with D or d. Can anyone help me out with this query.
    Thanks
    Durai

    Hi
    Use uppercase for example:
    Select * from emp where upper(empname) like ('D%');
    Ott Karesz
    http://www.trendo-kft.hu

  • Query with column rename not working! (SQLServer/JDBC-ODBC bridge)

    Hi,
    I was wondering if anybody could help. I am translating some stuff from ASP to JSP and ran into an SQL query that goes like this:
    String SQLQuery = "SELECT myTable.myColumn renamedColumn FROM myTable";
    which is perfectly legal in SQL Server. I get the stuff from myTable, no problem, and the column's name is locally indeed renamedColumn.
    Under the sun.jdbc.odbc.JdbcOdbcDriver, however, trying to do something like:
    string myResult = results.getString("renamedColumn");
    throws an SQL exception with the message "Index not found".
    And if I don't rename the column and try:
    myResult = results.getString("myTable.myColumn");
    also gives the same problem.
    Anybody know what to do?
    [P.S, the reason why I have to rename my column is because I have two tables with an identical column name and need both for a search page]

    Try retrieving by index instead of column name:
    E.G.
    string myResult = results.getString(1);

  • Simple query with like return wrong result

    Hi,
    I run simple query with like.
    If I use parameter I get wrong results.
    If I use query without parameter results are ok.
    My script:
    ALTER SESSION SET NLS_SORT=BINARY_CI;
    ALTER SESSION SET NLS_COMP=LINGUISTIC;
    -- drop table abcd;
    create table abcd (col1 varchar2(10));
    INSERT INTO ABCD VALUES ('122222');
    insert into abcd values ('111222');
    SELECT * FROM ABCD WHERE COL1 LIKE :1; -- wrong result with value 12%
    COL1
    122222
    *111222*
    select * from abcd where col1 like '12%'; -- result ok
    COL1
    122222
    I use Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    and query run in Oracle SQL Developer 3.1.07.

    Hi,
    welcome to the forum.
    When you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    You should specify exactly how you run your code.
    If I run this statement in SQL Plus:SQL> ALTER SESSION SET NLS_SORT=BINARY_CI;
    Session altered.
    SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;
    Session altered.
    SQL>
    SQL> -- drop table abcd;
    SQL> create table abcd (col1 varchar2(10));
    Table created.
    SQL>
    SQL> INSERT INTO ABCD VALUES ('122222');
    1 row created.
    SQL> insert into abcd values ('111222');
    1 row created.
    SQL>
    SQL> SELECT * FROM ABCD WHERE COL1 LIKE :1;
    SP2-0552: Bind variable "1" not declared.
    SQL>
    I got this error. So I wonder how you set value 12%
    Please specify exactly how you run your test as we cannot reproduce your problem.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Alert with Query does not have orange navigation / drill down arrows

    Hi Experts!
    My Alert which uses a Query doesn't allow me to drill down into the document (Sales Order) .  The Query for this alert is:
    SELECT T0.[DocNum], T0.[CardName], T0.[DocDueDate] 'Due Date', T2.[TrnspName],  T0.[U_PostCode], T1.[SlpName] FROM ORDR T0  INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode INNER JOIN OSHP T2 ON T0.TrnspCode = T2.TrnspCode INNER JOIN RDR1 T3 ON T0.DocEntry = T3.DocEntry WHERE T0.[CANCELED] = 'n' and  T1.[SlpCode] IN ('3', '4', '5', '6', '7', '8', '9', '17', '21', '29', '39') and T0.Address2 NOT LIKE '%'T0.U_Postcode'%' and   T3.[LineStatus]  = 'o' and T2.[TrnspName] Like '%%del%%' GROUP BY T0.[DocNum], T0.[CardName], T0.[DocDueDate] , T2.[TrnspName],  T0.[U_PostCode], T1.[SlpName] for browse
    Please can you help me on this?
    Many thanks,
    Caroline

    Hi Caroline,
    Try not to "group by" a query for alert with drill down.
    Cheers

  • Query with LOB's requires NET8 which is not detected on this pc

    Hi,
    i am running query from toad 7.2 i am getting following error:
    oracle version:9.2.0.6.0
    toad version:7.2
    select * from selector_t
    query with LOB's requires NET8 which is not detected on this pc
    SQL> desc selector_t
    Name Null? Type
    OBJ_ID0 NUMBER(38)
    SELECTOR_BUF BLOB
    Thanks
    Prakash
    Edited by: user612485 on Jan 6, 2009 10:52 PM

    user612485 wrote:
    toad version:7.2
    query with LOB's requires NET8 which is not detected on this pcLooks like a issue with Toad. Did you google and check Toad forums? Perhaps you could use SQL Developer instead?

Maybe you are looking for

  • PO print sent to multiple mail id  via email

    Hi, We are using the standard output type NEU, medium 5 (external send).i maintained multiple mail id in single vendor master, i want to sent po print out for multiple mail id via email,after wt are all configurations do as a mm and abap consultant,p

  • Problem with accordion behaviours

    Hi, with the new update, my accordions are not behaving as I set them up initially and I cannot use the new settings to effect any changes. I am aware that they have been updated, etc. I have them all closed initially and even though "Overlap items b

  • My iMovie is taking Ridiculously Long to Import Videos

    I am going to start from the beginning here. My iMovie has been taking unbelievably long to import movies, and I do not know why. My movie is recorded from my Hauppauge HD PVR, a recording device used to record the screen of my Xbox360. When the movi

  • Newby: locking the table on a SELECT?

    I have just downloaded SQL developer and have been using it to look at the back end of my work database, but it seems just as I started browsing through tables (by clicking on them in the tree explorer) people started getting kicked out of their fron

  • I just downloaded adobe photo shop trial version and i can't find it anywhere?

    hi i just downloaded it and i can't find where it's gone?