Using SQL to identify items that are not "ITEM.

Hello

I use these sample data:

WITH tbl_data AS
(
SELECT 1064 inv_id, 'ITEM' line_type_lookup_code FROM DUAL UNION ALL
SELECT 1064, 'ITEM' FROM DUAL UNION ALL
SELECT 9550, 'ITEM' FROM DUAL UNION ALL
SELECT 9550, 'REC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'NONREC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'REC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'NONREC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'ITEM' FROM DUAL UNION ALL
SELECT 9550, 'REC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'NONREC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'ITEM' FROM DUAL UNION ALL
SELECT 2548, 'REC_TAX' FROM DUAL UNION ALL
SELECT 2548, 'NONREC_TAX' FROM DUAL)
select *
FROM tbl_data;

Returns:

    INV_ID LINE_TYPE_LOOKUP_CODE
---------- ------------------
      1064 ITEM              
      1064 ITEM              
      9550 ITEM              
      9550 REC_TAX           
      9550 NONREC_TAX        
      9550 REC_TAX           
      9550 NONREC_TAX        
      9550 ITEM              
      9550 REC_TAX           
      9550 NONREC_TAX        
      9550 ITEM              
      2548 REC_TAX           
      2548 NONREC_TAX

I'm still working on how to identify invoices that DO NOT contain a line_type_lookup_code "ITEM", and where the line_type_lookup_code is LIKE '% % TAX '.

I can't just do something like this:

WITH tbl_data AS
(
SELECT 1064 inv_id, 'ITEM' line_type_lookup_code FROM DUAL UNION ALL
SELECT 1064, 'ITEM' FROM DUAL UNION ALL
SELECT 9550, 'ITEM' FROM DUAL UNION ALL
SELECT 9550, 'REC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'NONREC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'REC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'NONREC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'ITEM' FROM DUAL UNION ALL
SELECT 9550, 'REC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'NONREC_TAX' FROM DUAL UNION ALL
SELECT 9550, 'ITEM' FROM DUAL UNION ALL
SELECT 2548, 'REC_TAX' FROM DUAL UNION ALL
SELECT 2548, 'NONREC_TAX' FROM DUAL)
select *
FROM tbl_data
WHERE tbl_data.line_type_lookup_code LIKE '%TAX%';

Because it always returns invoice ID 9550.

I want to only return this:

INV_ID     LINE_TYPE_LOOKUP_CODE
---------- ---------------------
      2548 REC_TAX
      2548 NONREC_TAX

Since this is the only Bill that contains NOT also an "ITEM" line_type_lookup_code.

I was wondering how I might be able to do this?

Please, any advice would be much appreciated.

Thank you

Select *.

of tbl_data t1

where line_type_lookup_code like '% % TAX '.

and not exists

(

Select 1

of tbl_data t2

where t1.inv_id = t2.inv_id

and t2.line_type_lookup_code = 'ITEM '.

)

Tags: Database

Similar Questions

  • Embroidery using PES to disk files that are not playable on Windows Vist___

    I can't open files with PES on them... they are for embroidery purposes... I use Windows Vista

    Hey Robinson,

    A. do you receive any errors while you open the PES file?

    Have b. you been able to open this file earlier?

    If you do not have the PES software on your computer, you may need to download one and then see the file.

    If you only want to display the PES file so you can download viewer favorite PES using your search engine.

    I hope this helps.

    Bindu S Microsoft Support
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Is it possible to use Lightroom with several computers that are not networked?

    I'm new to Lightroom, even though I am a professional photographer for over 15 years. Currently, I use the software that came with my camera to process my RAW files, Professional Digital Canon's Pro for a 5 d Mark II.

    I've been evaluating the lasest version of Lightroom to consider buying it. So far, I like the capacity expanded to setting the image and improvements. However, in my current workflow, I need to be able to save the settings to be able to transfer the files to another computer. Is this possible with Lightroom? With Digital Pro, I can edit a RAW file and it will save the adjustments any computer, I opened the image file on. I have to be able to replicate this process in order to convey to our production department how I want an adjusted and cropped image.

    I downloaded the version track on two computers, then the images imported into Lightroom. Adjustments made, then copied the images to a flash drive. Images downloaded from the flash drive to my computer laptop, then re-imported the images in Lightroom and adjustments were not saved.

    Thanks for any help.

    After some research, my answer lies in the XMP file. Whenever I make changes to the image, I can save my settings by creating an XMP (CTRL S) file. He rewrote it in the original image folder so when I burn the file by hand to my production team, the xmp files parleyed my settings of the image. In turn, they can make adjustments and send them to me, if necessary. Just took some time to find the information, because even if I am kicking of tires on LR4, it was a video LR1 who gave me the information.

  • A way to show items that are not used in the sequence

    Hello world

    is there a way to display items that are not used in the sequence.

    in order not to forget the "rushes" in the Assembly?

    my best,

    Turn on the use Audio and video columns in the sandbox and then sort by those.

  • Find indexes in the schema that are not used

    Hello
    Anyone know an easy way to SQL or EM to find all indexes that are not used (not accessed) in a schema?
    Greetings

    Published by: user552215 on January 26, 2012 04:15

    Salvation;

    Please see:

    Identify unused indexes [ID 144070.1]
    Identify unused indexes with the ALTER INDEX TRACKING controls [ID 136642.1]

    Respect of
    HELIOS

  • y at - it a button to remove all the nuances that are not used in an file?

    Hey all,.

    I was wondering is there a button that removes all the nuances that are not used in an illustrator file?

    Any help would be great

    Look in the Actions Panel. It should be an action he who says to remove all unused items in the Panel.

  • queue on the profile that are not used

    Hi guys,.

    is anyway to wrap on the profile that are not used or attributed to any user name or roles?

    flaskvacuum wrote:
    Hi guys,.

    is anyway to wrap on the profile that are not used or attributed to any user name or roles?

    SQL> CREATE PROFILE test LIMIT
      2     FAILED_LOGIN_ATTEMPTS 5
      3     PASSWORD_LIFE_TIME 60
      4     PASSWORD_REUSE_TIME 60
      5     PASSWORD_REUSE_MAX 5
      6     PASSWORD_VERIFY_FUNCTION null
      7     PASSWORD_LOCK_TIME 1/24
      8     PASSWORD_GRACE_TIME 10;
    
    Profile created.
    
    -- Created but not assigned --
    SQL> select distinct profile from dba_profiles where profile not in (select profile from dba_users);
    
    PROFILE
    ------------------------------
    TEST
    
    SQL>
    
  • The feature you are trying to use is on a network that is not available. Click OK to try again or enter a different path to the folder that contains the installation packagr 'TrayApp.msi'

    Original title: trayapp

    When I open the computer message appears, the component you are trying to use is on a network that is not available. Click OK to try again or enter a different path to the folder that contains the installation packagr 'TrayApp.msi' in the box below.
    C:\Users\user\AppData\Local\Temp\7zS5216\setup\TrayApp\
    When I click ok the message this way that c:\users\user\appdata\local\temp\7zs5216\setup\trayapp\ is not found. Verfy that you have access to this location and try again or try to find the 'TrayApp.msi' in installing a package file from which you can install the product'TrayApp.
    When I try to cancel the warning message, is that an installation package for the TrayApp product is not found. Again the installation again using a valid copy of the 'TrayApp of installation' package. I already uninstalled all HP products, but this message is still bothering me, how to solve this problem?

    Hey Tama,


    -What version of windows is installed on the computer?
    -Have there been recent changes to the computer before the show?
    I recommend you go through the next HP document and check if it helps.
    Hope this information is useful.
  • Is there a way to remove "bootstrap" features that are not in use?

    Is there a way to remove "bootstrap" functions that are not currently in use of the css 'bootstrap' or is it necessary?

    You can customize the Bootstrap in the link below by choosing only the components/css to use, but unless you know what you're doing the Bootstrap default css file is best left alone. The extra css that you do not use does not really hurt.

    http://GetBootstrap.com/customize/

    I assume that you use the correct workflow - bind to Bootstrap css by default and then file if you want to avoid linking to your own css default css stylsheet. If you do this the default bootstrap css works without danger in the background. Yes, because of course, I understand what you say - why the hell have a zillion redundant css selectors that are related to the page if you use only a few dozen.

  • When file/collection, how can I delete all the related items that are not on my last composition?

    Hello, I have a great difficulty using the file/collection a large file I did months ago, because when I use it, the file is created, but it takes 2.5 to space! compared to others of my works, taking almost 1 TB of files, this one is too big and I think by deleting some files, but I don't want to make a mistake, so I wanted to ask here, if it is possible to take a main composition and only do a file/collection of this composition, objects and elements that serve there (the last I made on my account at least, with the elements used on that, because I think that there are many (if not a large part of them) files and elements that are not used in the final version, as scenes of the version beta of my work, the problem is the composition is too long and have a lot of different archives or drop movies then it could take forever to do it manually...

    Thanks for reading me! I hope that this is a solution...

    It's a two-step process:

    1. reduce your project to the desired composition.

    2 recover your files.

  • can I install PES 11 on two laptops that are not used in the same place?

    Can I install PES 11 on two laptops that are not used in the same place or at the same time?

    Yes, your license entitles you to two simultaneous activations.

  • How to remove e-mail messages. No icon in my tray tasks and how to remove several e-mail messages that are not consecutively

    First of all, I can't find a top of icon delete or bottom or anywhere. Secondly, when I'll be that solved how can I remove a number of emails that are not in consecutive order.

    You can click with the right button on the e-mail toolbar, select Customize, find the Delete button and drag it to the toolbar.
    You can activate the message pane by using the F8 key and use this header button.
    You can right-click on the message and select Remove.
    You can also use the Delete on your keyboard key.

    To select the messages you use standard Windows selection methods.
    Hold down the control key while clicking on messages to select random messages.

  • Help - why the songs that are not on my iPhone appearing in my list of app music albums/songs?

    I have over 500 GB of music on my Mac, so I create a playlist for the songs I want to sync my iPhone. Yet when I look at my phone, there are many songs that are not in sync would be playlist. They cannot be read unless the phone is connected to my wifi at home, but I don't want them cluttering up my phone and makes it almost impossible to find the tracks I want to listen to.

    I hate the new music app. For the first time since I converted to Apple 10 years ago, I wonder if I can be forced away because it's so horrible. Why ruin a great product with terrible software? Anyway, if anyone can help me to fix this serious bug, I would be very grateful.

    If you go to the library of the screen and press the red text just below the icons of the album/playlist (where you select whether you want the screen to show the view of the artist/Album/songs downstairs there is a toggle to only show that downloaded music.) If you enable this, then only the songs that are actually ON your iPhone will be in BLACK characters. The rest of your music library to iCloud either won't display at all or be grey. Now - if you have a few streaming, you can see more songs, because the songs that are heard are cached in the memory of the iPhone box and supposedly deleted automatically when it fills up (but not user accessible unless you use some third-party programs).

    What you can do - so they need WiFi or data cell-, it's make a playlist in iTunes that you want on your iPhone. Then (assuming that Apple music and iCloud music library are running on both), you can go to the playlist and press the small cloud/down arrow icon and download these tracks on your iPhone. Then, you can play these songs without access to wifi or cell phone.

  • Read VeriStand channel from inside the custom device that are not part of the custom device?

    Is it possible to read VeriStand channels from within a custom device VeriStand (RT Driver) that are not part of this custom device?

    For example, suppose I want to be able to configure a channel in my custom device to always be twice the value of a string of material that my user selects (I know, better/more simple ways to do this, but this is just a simple example ).  Can I do this from the device custom without programmatically create a mapping of the system? (I've done this before and it is messy and VERY prone to error of the user).

    Thank you!

    good point

    the channel ID (U64s) are not the same in the engine config of vs. Instead, you must set 'references to dependent item' in the config and then get these references in the engine.

    See the source jarrod linked, which makes it

  • Show files that are not removed

    Hello world!

    I need to find a way to display the files that are not deleted, but my code shows me just the last file that is not deleted...

    (True and false are written in red, because I use a french version of Labview )

    If anyone can help... Thanks in advance for your answer!

    crossrulz wrote:

    Something like this should work.

    Or if you want to keep this code on a postage stamp, you can use the tunnel contitional feature introduced in LabVIEW 2012.

    Come on Tim, get with the times

Maybe you are looking for

  • Why can't I open PDF links in Mozilla?

    I noticed that I can no longer click on a link on a Web site and open a PDF file, in the same or a new browser window. Here's a typical example of some html tags: < a href = "information.pdf" target = "_blank" > download < /a >, which works in all ot

  • You will need to get Win XP SP3 on my computer as soon as POSSIBLE!

    When I try to run updates of windows I get this: "window updates web page cannot be displayed". I had to reinstall windows xp due to virus, so I'm under SP2. Automatic Updates does not work or the other. Can someone help me?

  • WRE54G V3 - Web: gateway no response

    I configured my WRE54G, following the instructions and moved in my living room and confirmed that the link linght has turned blue.  Since my iPhone wif' are and my Nokia N97, we now see a signal of 100%, up from 45 percent before installing the expan

  • Cannot burn files to CD/DVD more? (Windows 7)

    This problem is everywhere on the internet but I have yet to see a solution that is tailored for someone else to do a system restore that is not an option. I burned the files on my internal drive by dragging and dropping them in the folder to the bla

  • BlackBerry Smartphones gray out?

    I have a Blackberry Pearl 8130.  I love her, for the most part.  I'm here to learn more about this however. I had this strange problem lately.  Rather than show me the "bars", it has the words (in gray) OFF in the upper right corner.  I took it to th