Alternate to Not IN

Hello,
I am using the following query to display count of unapproved transactions.
SELECT GH_TXN_CODE , COUNT(*)TOTAL
FROM OT_GR_HEAD
WHERE GH_APPR_UID IS NULL
AND GH_TXN_CODE NOT IN ('S_SIF','S_SIE')
GROUP BY GH_TXN_CODE
UNION
SELECT PH_TXN_CODE, COUNT(*)
FROM OT_PO_HEAD
WHERE PH_APPR_UID IS NULL
AND PH_TXN_CODE NOT IN ('S_PIE', 'S_PIO')
GROUP BY PH_TXN_CODE
It is taking nearly three minutes to execute the query.
Please suggest alternate to NOT IN to impore performance.
Regards
Krishna

SELECT GH_TXN_CODE,sum(decode(PH_TXN_CODE,'S_SIF',0,'S_SIE',0,1)) TOTAL FROM OT_GR_HEAD WHERE GH_APPR_UID IS NULL
--AND GH_TXN_CODE NOT IN ('S_SIF','S_SIE')
GROUP BY GH_TXN_CODE
having sum(decode(PH_TXN_CODE,'S_SIF',0,'S_SIE',0,1)) > 0 --added by me
UNION
SELECT PH_TXN_CODE,sum(decode(PH_TXN_CODE,'S_PIE',0,'S_PIO',0,1)) FROM OT_PO_HEAD WHERE PH_APPR_UID IS NULL
--AND PH_TXN_CODE NOT IN ('S_PIE', 'S_PIO')
GROUP BY PH_TXN_CODE
having sum(decode(PH_TXN_CODE,'S_PIE',0,'S_PIO',0,1)) > 0 --added
try this,
Cheers,
Sivarama

Similar Messages

  • Alternate for NOT LIKE....

    I am using NOT LIKE in sql query....it is running gud in dev instance,But in prod instance it is causing performance issue.
    can any one pls suggest alternate for NOT LIKE.
    But in dev n prod having same data.
    Thanks,
    Sai

    Hi Saichand,
    well, actually what do you expect? ;)
    You ask the DB to filter out specific lines and this takes time.
    What worries me is the fact that it performs fine on the development environment, but runs slow on the production environment. Did you find out what the reason for this is? Is the prod system loaded too heavily?
    There are many alternatives for "NOT LIKE". Within SQL and even outside of SQL. You can do the filtering in the final application even. Would not recommend this, but sometimes it's faster to just stream the data to the final application and to the processing there (if the processing takes lot of CPU and your DB is anyway loaded already too much).
    I'd try to find out why the dev is faster than the prod env. Normally it should be the way round ;)
    regards,
    David.

  • Alternate for NOT IN function

    NOT IN always takes long time to complete the process. is there any alternate ?
    Thanks
    Raj

    Depending on your data an IN query can be faster as well. Create the list using a sub-query to perform a minus query. Such as
    Select Distinct State From Companies
    Minus
    Select Distinct State From Companies where State in ('GA', 'SC', 'TN', 'NC', 'FL', 'AL')This will check all Companies not in GA, SC, TN, NC, FL and AL. It makes the list by getting all and then removing the ones you don't want listed. Give it a try it has reduced quite a few run times for me in the past. I avoid NOT IN like the plague because I work on fairly large systems and the performance is horrible.

  • Alternate Index not read with FOR ALL ENTRIES

    I have a select statement like:
          SELECT d~dokar
                 d~doknr
                 d~dokvr
                 d~doktl
                 l~lifnr
                 l~stcd1
                 l~stcd2
                  APPENDING CORRESPONDING FIELDS OF TABLE t_dms
                 FROM lfa1 AS l JOIN drad AS d
                      ON llifnr = dobjky
                 FOR ALL ENTRIES IN t_infile
                 WHERE  ( l~stcd2 =  t_infile-taxcode2ssn
                    OR  l~stcd2 =  t_infile-taxcode2fed
                    OR  l~stcd2 =  t_infile-fedtaxid2 )
                   AND  d~dokob =  'LFA1'
                   AND  d~obzae =  '0000'
                   AND  d~doktl IN s_doktl.
    I have defined an alternate index on LFA1 called ZX2 (MANDT, STCD2). T_INFILE is sorted by a field called FEDTAXID. This is a nine character field. TAXCODE2SSN is the same number but it is formatted 999-99-9999. TAXCODE2FED is the same number only formated 99-0000000. FEDTAXID2 is the same as FEDTAXID.
    S_DOKTL is defined as sign = I, Option = BT, Low = 000, High = 000.
    The problem is LFA1ZX2 is not being used. The file is being read sequentially. Any ideas what is causing the alternate index to be ignored?  I wrote another select statement where I removed the FOR ALL ENTRIES and the "ddoktl IN s_doktl" and the alternate index is being used. Any thoughts?
    Thanks,

    It's probably the OR-condition causing the problem. An alternative could be a driver table (t_infile or a new one) that does not have one line with three tax code variations but rather one line for each variation in  one generic column. If this driver table is sorted by tax code and stripped of duplicates, there might be an improvement possible.
    Thomas

  • Alternate audio not working

    I have a video encoded with Handbrake where there are two audio tracks... the main audio which is stereo and an alternate track that is surround. The problem is that in the audio select menu, both tracks are listed as English and both are checked. I'm only hearing the stereo soundtrack (the surround one has completely different audio, so I'd know if it was playing). Do surround soundtracks only play through the digital out? Will turning that off help?
    I could potentially re-encode the alternate track as just stereo, but I'm thinking that the alternate audio feature in the AppleTV is only for multiple languages, so it only plays the first one that matches the language set in Settings. Both being English, I'm only getting the main track, and it's not letting me switch to the other one. I'm assuming this is because any English track is on whenever English is selected as the language, and when one or more tracks match the selected language, only the first one plays.
    Is this making sense? Can anyone help me?

    I'm having the exact same problem... So confused... Why would it have that option if it doesnt do anything? I used Handbrake as well. The 2 audio tracks show up on Quicktime and iTunes, but I cant use em when theyre on my iPod. Please help

  • Img tag - alternate text not read on Vista laptop

    Hello,
    I noticed something curious and maybe it migth just be a small thing to have it solved.
    On my website www.lotolux.com I added to my pictures the alternate text.   On my desktop under XP when I go with the cursor over those pictures the alternate text appears.
    I have also an Acer Timeline laptop and here I have Vista on it.   Now when go to my website using my laptop the alternate text doesn't show up.
    Has this something to do with Vista?  How can solve this ?
    Many thanks for your help
    Kind regards
    Martine

    Murray, Martin,
    ""IE8 does not show the alternate text"
    How come that IE8 does show the alternate text on my pictures when I go on the internet using my desktop under XP.
    When I use my laptop with Vista + IE8 it doesn't work.
    So I assume it is the combination XP+IE8 that do work, but the combination Vista+IE8 doesn't.  Is that correct?
    Then hopefully Windows 7 will fix that bug.
    Murray,
    Where can I find the "title attribute" in DW CS4?  Couldn't find it yet.
    Many thanks to you both for helping me out.
    Martine

  • Alternate Layouts not like InDesign

    I am trying to use the alternate layout feature in Muse but it is not working like it does in InDesign. Creating blank pages doesn't really help much and not linking the text makes for double work.
    Are there any plans for the future to change this feature to be more like InDesign?

    I know it does not serve the same purpose. I just think it would be better if there were a choice to include the content. It is a lot easier to re-arrange then to start from scratch or cut and paste.
    More important - linking the text so that a change can be updated in all layouts without re-entering. Also, adding photos could be automatic across layouts - again if you want to.

  • Entity data in alternate rollup not rolling up to parent.

    We have a number of different entity hierarchies in our application.  In our main entity hierarchy we have system rules setup to pull specific account data down to STAT accounts for particular entities and then that same STAT account data is pulled over to another entity multiplied by -1 as an offset so when the two entities rollup to a common parent the result is 0.  This offset entity exists in other hierarchies.  In the other hierarchies this offset entity STA account data does not rollup to the parent.  The data only shows up to Parent Currency Total in the value dimension.  Anything above that is empty, but viewing the parent.child combo in the main hierarchy and we can see data populated all the way up to Contribution Total, therefore roling up to the parent.  Below is the rules we have setup.
    Here in simplier terms is what we see.
    Hierarchy 1
    Entity A = $10
    Entity B = -$10
    Parent Entity C = $0
    Hierarchy 2
    Entity B = -$10 (Entity A does not exist in this hierarchy)
    Parent Entity D = $0 (should be -$10)
    Has anyone see an issue like this before?
    Rule
    If HS.Scenario.Member <> "ProForma" Then
       If HS.Value.Member <> "[Elimination]" Then
      If HS.Entity.Member() = "E261" Then
       HS.Clear "A#AC90285"
       HS.Exp "A#AC90285 = A#AC76740"
       HS.Clear "A#AC90286"
       HS.Exp "A#AC90286 = A#AC70160"
      End If
      If HS.Entity.Member() = "E271" Then
       HS.Clear "A#AC90285"
       HS.Exp "A#AC90285 = A#AC76740"
       HS.Clear "A#AC90286"
       HS.Exp "A#AC90286 = A#AC70160"
      End If
    'E103 - Corporate offset
    If YearPOV > "2013" Then
      If EntityPOV = "E103" Then
       HS.Clear "A#AC90285"
       HS.Exp "A#AC90285.I#[ICP None] = (E#E300.A#AC90285.I#[ICP Top] + E#E104.A#AC90285.I#[ICP Top]) * (-1)"
       HS.Clear "A#AC90286"
       HS.Exp "A#AC90286.I#[ICP None] = (E#E300.A#AC90286.I#[ICP Top] + E#E104.A#AC90286.I#[ICP Top]) * (-1)"
       HS.Clear "A#AC90287"
       HS.Exp "A#AC90287.I#[ICP None] = (E#E300.A#AC90287.I#[ICP Top] + E#E104.A#AC90287.I#[ICP Top]) * (-1)"
       HS.Clear "A#AC90288"
       HS.Exp "A#AC90288.I#[ICP None] = (E#E300.A#AC90288.I#[ICP Top] + E#E104.A#AC90288.I#[ICP Top]) * (-1)"
      End If
      End If

    There are trigger account rules, but not for this scenario.  This also occurred before we added those rules.  If you see below in our main hierarchy E100 we have a corporate offset for -2,695,080 which goes against the data rolling up in E104 and E300.  In the secondary hierarchy only E103 exists with one other entity E428 and for some reason that offset data does not roll up to the parent E060.

  • Alternate Layouts not flowing to iPad

    I created a simple folio with three articles in CS6.
    For each article I created horizontal and vertical alternate layouts for Kindle Fire, Android, and iPad.
    The folios download to the Fire and the Xoom and display as expected. The iPad doesn't see the folio at all. Using most recent version of the Viewer 2.5.0.
    Has anyone else seen this behavior? Am I (as per usual) missing something?
    Thx
    DMc

    Yes, both the V and H are those dimensions.
    I just went in and made a few corrections - making certain that no content was outside the guides. And then updated the articles, but it hasn't showed up in the Viewer.
    I find it noteworthy that the Document Setup shows a page size of Kindle Fire/Nook in the pull down, and then in the Edit Page Size flyout menu of the Pages panel I have selected iPad. Might I have been better off creating the thing for iPad and then making the alternate layouts from that one?
    I will create a new folio now with only the iPad layout, and see if it appears in the Viewer. If so, I will add the alternate layouts.
    Finally, is "Alternate Layout" a synonym for "Rendition" now in CS6?

  • Alternate layout not working on pages with Tables on them

    Good Day All,
    Using Mac OS X version 10.7.5 and Indesign CC 2014.
    I have a 24 page file that I need to resize from 14.22 x 10.66 to 12 x 9.
    I'm using alternate layout with scale checked. All pages are now the new size
    except for some reason the 3 pages that have tables built on them. I used the page tool
    to resize those 3 and I now know to alway check this. Just wondering if it a known
    problem or if anyone else has had the same problem. Or possiblly a work around, What if
    all pages had tables on them?
    Thanks much,
    Patty

    I'd consider tables a limitation of the Alternate Layout feature. The feature was designed for creating mobile device screen sizes using text and graphics—particularly when changing orientation, or displaying on different types of mobile devices. In general, tables don't work well in those situations, and I don't think the engineers ever developed it for your application.
    Also, alternate layouts were to assist the designer to speed up the work. It was never intended that the software would ever completely automate the process. It was expected that the results would have to be tweaked.

  • How do I access "Firefox is NOT compatible with this application. For best performance, please use Internet Explorer 5.0 and above...." web sites; when I try to download any alternate browser, then a warning that alternate is "imcompatable with your opera

    How do I access websites that warn: "Firefox is NOT compatible with this application. For best performance, please use Internet Explorer 5.0 and above...."? When I try to download any alternate browser, all I get is another warning that the alternate is "not compatible with your operating system." Is Firefox preventing this? The site listed below is a job application site. I've had this same problem with other job application sites also.
    == URL of affected sites ==
    https://storefront.kenexa.com/lithia/cc/Home.ss

    There should be a User Agent Switcher menu item under Tools, which gives you the browser names you can impersonate.
    The menu item name changes to the browser UA you are presently using.
    There is also a User Agent Switcher button, you can add it using View -> Toolbars -> Customize, and dragging the button to your toolbar.
    See http://chrispederick.com/work/user-agent-switcher/features/ and http://chrispederick.com/work/user-agent-switcher/help/
    You can just start trying IE versions (or the versions it says on the site) until it lets you in.

  • Buttons do not appear in alternate layouts

    Hi
    I have a 45 page app.  Each page has button on it that call other pages, play video, or call an MSO
    When I create alternate layouts not all the buttons appear on the new layout
    the buttons that DO appear are:
    1. A button that calls n MSO with two states
    2. A button that calls a video to play
    The buttons that do not appear in the new layout are buttons that call another page in the book.
    I have hundreds of buttons in the app/book.  All the buttons are on their own layer in each document and that layer is at the top of the layer panel.
    How can I make the buttons show up on alternate pages?
    If I have to copy and paste the buttons to the new layouts - is there a method that the copy and paste command actually keeps the link, so I don't have to relink every button on each of the new layouts... that is a big nuisance.
    So.. I guess I have two questions:
    1. How to make the buttons automatically appear on alternate layouts
    2. If they won't appear how can copy and paste have some brains?
    thanks
    Deb

    Since alternate layouts and buttons are core InDesign features, moving this post to the InDesign Forum.
    Neil

  • Can I reference a rangelist in an alternate shared member hierarchy?

    I would like to sum a range of accounts based upon an alternate hierarchy, not the main hierarchy.  In the main hierarchy they are 1,5,4,3,2, and in the alt hierarchy they are shared in the right order of 1,2,3,4,5.  If I reference the range 1:3, how can ensure I get 1,2,3,4 and not 1,5,4,3? 
    Background:
    Basically I am trying to map a sum of numeric range of general ledger account numbers to another management account based on members of 2 other dimensions.  The main issue I have is that, since I haven't found the function that can alphanumerically sort a list within a member selection, and my GL accounts are not in order in the main hierarchy because of a reorder of their parents, I have loaded these as a sorted flat list of shared members to another hierarchy.  Now I would just like @LIST(1:3,[the optional parent node to use as reference]) function.  I suppose another way to ask the question might be:  How do I reference member names in Essbase as numeric ranges as one would in an ERP?
    Maybe there is another way and I am approaching it all wrong?
    Essbase v11.1.2.3.507 (as part of Planning)

    So what you really want is to extract all accounts with a number between e.g. 1 and 4 (even if the same parent has other children 5, 6, 7, and so on)?
    @BETWEEN would do it, in that case.

  • Alternate color in Row footer

    alternate color not applied in Table footer.
    Can any one let me know how to acheive this?

    Hi,
    You can use a normal alerter for this.
    A manual alerter can use a formula like Even(LineNumber()) to give a shading or not...
    Then again, don't you want the footers to stand out from the body of the table?
    Hope this helps,
    Marianne

  • CUCM not communicating with SIP Gateway

    This is my lab environment:
    VOIP.MS --> 2811 CUBE--> CUCM 10.5.2
    Attached is my configuration on both my cube and publisher
    What is going on is if I make a call from my IP Communicator phone it does not call out.  Also if I do a debug ccsip all, I get no output from the calls I make going out.  I have not even attempted the incoming since I believe that my cucm server and gateway are not even communicating with each other.  Please let me know if I am doing something wrong.
    Thanks

    Results Summary
    Calling Party Information
    Calling Party = 462
    Partition = 10Digit:7Digit:Internal:LongDistance
    Device CSS =
    Line CSS = CSSLongDistance
    AAR Group Name =
    AAR CSS =
    Dialed Digits = 918042221111
    Match Result = RouteThisPattern
    Matched Pattern Information
    Pattern = 9.1[2-9]XXXXXXXXX
    Partition = LongDistance
    Time Schedule =
    Called Party Number = 18042221111
    Time Zone = Etc/GMT
    End Device = WANLIST
    Call Classification = OffNet
    InterDigit Timeout = NO
    Device Override = Disabled
    Outside Dial Tone = NO
    Call Flow
    Route Pattern :Pattern= 9.1[2-9]XXXXXXXXX
    Positional Match List = 18042221111
    DialPlan =
    Route Filter
    Filter Name =
    Filter Clause =
    Require Forced Authorization Code = No
    Authorization Level = 0
    Require Client Matter Code = No
    Call Classification =
    PreTransform Calling Party Number = 462
    PreTransform Called Party Number = 918042221111
    Calling Party Transformations
    External Phone Number Mask = NO
    Calling Party Mask =
    Prefix =
    CallingLineId Presentation = Default
    CallingName Presentation = Default
    Calling Party Number = 462
    ConnectedParty Transformations
    ConnectedLineId Presentation = Default
    ConnectedName Presentation = Default
    Called Party Transformations
    Called Party Mask =
    Discard Digits Instruction = PreDot
    Prefix =
    Called Number = 18042221111
    Route List :Route List Name= WANLIST
    RouteGroup :RouteGroup Name= WANGROUP
    PreTransform Calling Party Number = 462
    PreTransform Called Party Number = 918042221111
    Calling Party Transformations
    External Phone Number Mask = Default
    Calling Party Mask =
    Prefix =
    Calling Party Number = 462
    Called Party Transformations
    Called Party Mask =
    Discard Digits Instructions =
    Prefix =
    Called Number = 918042221111
    Device :Type= SIPTrunk
    End Device Name = SIP2800
    PortNumber = 0
    Device Status = UnKnown
    AAR Group Name =
    AAR Calling Search Space =
    AAR Prefix Digits =
    Call Classification = Use System Default
    Calling Party Selection = Originator
    CallingLineId Presentation = Default
    CallerID DN =
    Alternate Matches
    Note: Information Not Available
    I also adjusted my dial-peer to be:
    dial-peer voice 10 voip
     destination-pattern 1[2-9].........
     session protocol sipv2
     session target dns:newyork4.voip.ms
     voice-class codec 1
     dtmf-relay sip-notify rtp-nte
    I also verified I can ping newyork4.voip.ms

Maybe you are looking for