How to get this required information via SQL

Dear All
I have a requirement & i am not getting a way out of it.
Consider Sample Data as
Table Name >> INVOICE
Data :
INV_N0 PRODUCT_NO SOLD_QTY
1 1 2
1 2 3
1 3 1
2 2 11
2 3 12
3 2 10
4 3 22
Now my requirement is to fetch data of particular invoices that contains a certain set of products.
e.g.
If i want invoice that contain only product no 2 & 3 then my out put should be.
INV_N0 PRODUCT_NO SOLD_QTY
1 1 2
1 2 3
1 3 1
2 2 11
2 3 12
Means i want to fetch data of complete invoice containing a certain set of products from that invoice.
Regards
Capri
Edited by: Capri on Apr 8, 2010 4:57 AM

probaby not the best performance, but you have a PRODUCT IN () list, which is what you wanted
with t as (
select 1 inv_no, 1 product, 2 sold_qty from dual union all
select 1, 2, 3 from dual union all
select 1, 3, 1 from dual union all
select 2, 2, 11 from dual union all
select 2, 3, 12 from dual union all
select 3, 2, 10 from dual union all
select 4, 3, 22  from dual
, tt as (
select t1.*, (select count(*)
              from   t t2
              where  product in (2,3)
              and    t1.inv_no = t2.inv_no) cn
from t t1
select * from tt
where cn > 1

Similar Messages

  • How to get this output using sql query?

    Hi,
      How to get this output using sql query?
    Sno Name Age ADD Result
    1 Anil 23 delhi Pass
    2 Shruti 25 bangalor Pass
    3 Arun 21 delhi fail
    4 Sonu 23 pune Pass
    5 Roji 26 hydrabad fail
    6 Anil 28 delhi pass
    Output
    Sno Name Age ADD Result
    1 Anil 23 delhi pass
    28 delhi pass

    Hi Vamshi,
    Your query is not pretty clear.
    write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
    Regards,
    Kannan

  • How to get this information for Conky

    Hi people,
    My question is how to get this information for show in Conky:
    - KDE version.
    - Last sync (pacman -Sy) and Last update (pacman -Su)
    For the first point could be use a script that execute $ kdesu --version and get information from there.
    I have no idea how get information from pacman (may be logs?).
    Any ideas?
    Thank you.

    I have had tremendous success with LUA in Conky on Arch. And all you need to to is put the text HI after the "TEXT" line. ^^;
    Examples of my LUA usage:
    http://fc02.deviantart.net/fs71/i/2010/ … usLink.png
    http://kittykatt.silverirc.com/screens/conky-HUD.png
    EDIT:  Also, I've had success with getting the KDE version by doing the following...
    kwin --version | awk '/^Qt/ {data="Qt v" $2};/^KDE/ {data=$2 " (" data ")"};END{print data}'
    This is the method I'm currently using in screenFetch. Tested it a couple of times myself, but besides that, I'm not sure if it will work or not.
    Last edited by kittykatt (2010-04-22 17:52:25)

  • How to get IPv6 site prefix via Windows API?

    Hello,
    we need urgent help. We have to automatically configure a postgres sql server. For this reason we need to determine the IPv6 site prefix. Using windows command line this is pretty easy:
    netsh interface ipv6 show siteprefix
    We are only interested in the site prefixes themselves, e.g. no lease time is needed. We want to get this information via Windows API.
    For this purpose we use GetAdaptersAddresses function. Within the result of
    FirstPrefix the needed information is included. But it's much to much information and it's not clear for us how to filter the result. We need always
    exact the same result like the command above produces.
    Any help or hint would be very very appreciated.
    Greg

    Hi Valery,
    I mean a Portal Resource..
    Inside portal, when a go to properties  of a specific document, in tab "Access Link" it shows a "Short Id".
    I'd like to know via API how to get this Id, or any other Code that it's unique for every resource or document in portal.
    Thank you!

  • SqlServer 2008 Database Status Showing(Recovery pending)..How to get this database in online?

    SqlServer 2008 Database Status Showing(Recovery pending)
    How to get this database in online?
    This is SharePoint Content database.
    Badri

    SqlServer 2008 Database Status Showing(Recovery pending)
    How to get this database in online?
    This is SharePoint Content database.
    Badri
    Hi,
    Please try running below in master database
    restore database db_name with recovery
    Chances are that this command would not succeed because I guess there was corruption in database and you restarted SQL Server service. Or can you please tell how your database went into recovery pending state.
    Please check SQL Server errorlog you would find information regarding this change. Please post relevant log information here. Please check event viewer as well
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • How to approach this requirment

    Business  overview:
    For every organisation account management will be the core functionality. The account management should include the following:
    customer - company - vendor.
    1. customer info
    2. vendor info
    3.organisation info
    4.material info
    5.purchase order info
    6.sales order info
    7.subsequent documents such as delivery doc,invoice doc n accounting doc info.
    Reports:
    1.purchase order line item wise report.
    2.open purchase order.
    3.sales order line item wise report.
    4.open sales order report.
    5.open invoice item wise.
    Im new to ABAP, pl someone guide me how to approach this requirment. Which r the tables n fields i need to work with?
    Thank you.

    Hi Ashwini,
    I am giving you some of the important details of tables as per your requirement.But there could be more tables than i am providing.
    Just a list of tables that come in handy.
    Sales orders
    Name       Description                                 Uses
         LIKP       Shipped Lines header   
         LIPS       Shipped Lines detail  
         VBAK     Order header                             Every order (unless archiving)
         VBAP     Table fields                               Every line item (unless archiving)
         VBBE     Open sales order line items       Great file, but be careful.Contents don't reflect orders
                                                                       that  do not affect purchasing (go figure).
         VBEP      Schedule line item   
         VBFA      Document flow                         Let's you move from order to shipping document to invoice.
         VBUK      Order status   
         VBUP      Line item detail status   
         VBFK      Invoicing header   
         VBFP      Invoicing detail  
    Material Management
    Name        Description                                   Uses
        MARA      Inventory Master 
        MARC           Plant Data 
        MARD      Current Inventory 
        MAKT       Descriptions 
        MBEW      Material Valuation 
        T179         Product Hierarchy  
        MVKE       Sales data (materials) 
        MKPF      Material document                     Status code 'R' in VBFA
    Purchasing
    Name      Description                                       Uses
       EINA       Purchasing inforecord                 by MATNR/LIFNR contains things like vendor material
                                                                      number and access key for EINE 
       EINE       Purchasing inforecord detail        Contains minimum purchase, group, currency 
       EKPO     Purchase orders   
       EKET      Scheduled lines   
       EKES     Vendor confirmed lines
       IKPF       Header- Physical Inventory Document
       ISEG      Physical Inventory Document Items
       LFA1      Vendor Master (General section)
       LFB1      Vendor Master (Company Code)
       NRIV      Number range intervals
       RESB     Reservation/dependent requirements
       T161T     Texts for Purchasing Document Types
    Forecasting
    Name      Description                                          Uses
       MAPR  
       PROP  
       PROW  
    Classification
    Name             Description                                            Uses
       KSSK            Material number to class 
       KLAS             Class description 
       KSML             Characteristic name 
    CABN/CABNT     Characteristic name description 
    CAWN/CAWNT   Characteristic name 
       AUSP              Numeric values 
      CAUFV             Service order header 
       AFPO              Service order line                          Holds items that will create "reservations"
      RESB               SM Reservations                                 Materials needed for line
    Customer Data
    KNA1        Customer Master  
    KNVV        Sales information   
    KNVP        Partners (ship-to, etc)   
    Since you are new to abap, its better you to know the system tables and other tables for configuring: 
    System tables
    Name       Description                   Uses
      DD02T      Table texts 
      DD03L      Table fields               Lists the fields in a table
      DD04T    Data element texts 
      USR02    Valid user names 
    Config tables (normally begin with "T")
    Name       Description                              Uses
      T001            Client table 
      T002            Languages 
      T005           Region (Country) 
      TCURR        Currency and exchange rates 
      TVAK         Order type 
      TVSB          Shipping condition  
      TVAGT        Rejected reason for order line  
    Other tables
    Name        Description                              Uses
      STXH           Text header 
      STXL            Text detail
    Reward points if useful.
    Thnakyou,
    Regards.

  • How to approach this requirement

    Business  overview:
    For every organisation account management will be the core functionality. The account management should include the foll:
    customer - company - vendor.
    1. customer info
    2. vendor info
    3.organisation info
    4.material info
    5.purchase order info
    6.sales order info
    7.subsequent documents such as delivery doc,invoice doc n accounting doc info.
    Reports:
    1.purchase order line item wise report.
    2.open purchase order.
    3.sales order line item wise report.
    4.open sales order report.
    5.open invoice item wise.
    Im new to ABAP, Please someone guide me how to approach this requirement. Which are the tables and fields i need to work with?
    Thank You.
    Ashwini

    Hi:
    Refer to SAP Tables in this documentation.
    http://www.erpgenie.com/abap/tables.htm
    You will find the realted fields in the weblink.If you are not unable to find the field and table, go to functional consultant and ask him about the filed.
    he will show you and click on F1.you can see the techncail information.Click on this and you will see table name and field name.
    Please let me know if you need more information.
    Assign points if useful.
    Regards
    Sridhar M

  • I tunes has stopped working in windows 7 and I don't know how to get the crash information that everyone else seems to get to know what the cause is....any help?  I have a toshiba windows 7 computer.

    I have a toshiba computer and it is windows 7, recently after I installed imatch everytime I open itunes I get the message 'i tunes has stopped working' and windows cannot find a solution and has to close.  There is no solution and I don't know how to get the crash information on my computer....can anyone help as I want to finish downloading all my songs to match to be available on my mac products.

    Re: That garbage is unreadable.
    If you really want help, stop messing with the fonts and post so that others can read and offer suggestions.
    Or better yet... try a search, I'm certain you'll find a solution to whatever issue you're experiencing.
    I have found that many times it is the things that make you most angry that push you to action. This was the case here. Thank you for causing me to get so angry that I found the answer myself.

  • How to Get a Resource Id via API

    Hi,
    Is there any way to get the short id associated with a resource via API??
    I need to get an Id from a resource that it's unique for every one, so I can show an identifier for every document in a custom report...
    Thank you,
    Felipe Vieira

    Hi Valery,
    I mean a Portal Resource..
    Inside portal, when a go to properties  of a specific document, in tab "Access Link" it shows a "Short Id".
    I'd like to know via API how to get this Id, or any other Code that it's unique for every resource or document in portal.
    Thank you!

  • My itunes store won't open. Any suggestions on how to get this to work? I've already downloaded the newest version of itunes. I'm also not sure what Mac operating system I have..

    My itunes store won't open. Any suggestions on how to get this to work? I've already downloaded the newest version of itunes. I'm also not sure what Mac operating system I have..

    To find the version of Mac OS X on your computer, all you have to do is click the Apple logo and then About this Mac. For more info, take a look at this doc -> Finding your OS X version and build information
    Do you see an error when you try to open the iTunes Store on your Mac?
    This Apple doc is a good place to start -> iTunes: Advanced iTunes Store troubleshooting

  • How to get this column (SYSDATE-CREATEDON DATE)

    I have a reporting requirement to get a column subtracting two date fields and result gets displayed in days.
        I have a notification number with CreatedON date field in my DSO. Now for notification age, I have to subtract SYSDATE(which is current day)-CREATEDON date(for Notification Number)
      AGE(in days) = SYSDATE - CREATEDON DATE
    Can anyone give me some suggestion on how to fulfill this requirement?
    Thanks in Advance
    N

    Hi,
    The steps in Query designer 7 are :
    1) Open your Query
    2) Go to Columns area and create a structure and under this strcuture create a formula by context menu.
    3) In the edit screen of Formula : Right click on <i>Formula varibles</i>(Available operands) and select new varible
    4) Now select edit option from the context menu of the new varible :
    in general tab page take processing by <i>Customer Exit</i> and change the desription to FV1.
    in details tab page , take variable as  Mandatory and remove tick mark for <i>Ready for input</i>.
    In currency/unit tab page . take Dimensions as Date.
    5) Again ,In the edit screen of Formula : Right click on <i>Formula varibles</i>(Available operands) and select new varible
    6) Now select edit option from the context menu of the new varible :
    In general tab page take processing by <i>Replace ment path</i> and change the desription to FV2.And Take 0NOTIFICATION as <i>reference Characterstic</i>.
    In the REplace ment path tab page , Attribute value for<i> Varibale represents</i> and tehn take CREATEDON as the <i>Attribute</i>.
    In details tab page , take variable as  Mandatory and remove tick mark for <i>Ready for input</i>.
    In currency/unit tab page . take Dimensions as Date.
    7) Now in te formula created in teh step 2  , take FV1-Fv2 as <i>Detail View</i>
    8) Write the code for FV1 in Cmod as below:
    DATA: L_S_RANGE TYPE RSR_S_RANGESID.
    DATA: L_S_RANGE2 TYPE RSR_S_RANGESID.
    DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
    DATA: LOC_VAR_RANGE2 LIKE RRRANGEEXIT.
    CASE I_VNAM.
    WHEN 'ZFV1'.
        IF I_STEP = 2.
             L_S_RANGE-LOW = sy-datum.
            L_S_RANGE-SIGN = 'I'.
            L_S_RANGE-OPT  = 'EQ'.
            APPEND L_S_RANGE TO E_T_RANGE.
          ENDLOOP.
        ENDIF.
    endcase.
    With rgds,
    Anil Kumar Sharma .P
    With rgds,
    Anil Kuamr Sharma .P

  • How to get this  com.sap.portal.admin.wizardframework_api.jar file

    Hi this is related to the wizard creating component required .jar file. Can any body tell me , how to get this jar file. I have searched in my IDE plug-in's folder. But i have nt find this.
    com.sap.portal.admin.wizardframework_api.jar
    how to get thid jar file.
    REgards
    Vijay

    Hi,
    You should have com.sap.portal.admin.wizardframework in your SharingReference:
    <property name="SharingReference" value="com.sap.km.application, com.sap.portal.admin.wizardframework"/>
    Pls check this link,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/bf4172cb951d66e10000000a1553f6/content.htm
    Hope this helps !
    Regards
    Srinivasan T

  • I have purchased itunes match but the cloud will not load on my ipad 4.the only music that will show up is stuff that i bought from the itunes store.any ideas on how to get this to work?

    i have purchased itunes match but the cloud will not load on my ipad 4.it works on my iphone 5 & it originally worked on my ipad.the only music that will show up is stuff that i bought from the itunes store.any ideas on how to get this to work?

    On the MBP, in iTunes, switch to Song view and enable the iCloud Status column by pulling down View > View options and selecting the option for "iCloud Status." Close the small window. Look for any tracks that have a status of "waiting." If you see several of them disable iTunes Match while holding down the Option key. Quit iTunes, wait a few seconds, then open it again and turn iTM back on. Let it compelete the scan. Wait until all tracks that are "waiting" have a status of either "matched" or "uploaded."
    On the iPad, turn off iTunes Match then launch the Music app and let the contents clear out. Power cycle the iPad for good measure, then re-enable the service once all the tracks in iTunes have been processed.

  • How to get this look in photoshop?

    How to get this look in Photoshop or by any other online application?

    if its just black and white then can i suggest one of many tutorials on youtube
    http://www.youtube.com/watch?v=9KGBIeGFvsY
    or if you wanted a more rugged look
    http://www.youtube.com/watch?v=LpHdlQRaflg

  • Facebook like button is not working, I have used the muse widget and created code from facebook. Does anyone know how to get this to work?

    Facebook like button is not working, I have used the muse widget and created code from facebook. Does anyone know how to get this to work?

    Hi connally25,
    Below is a link to a video tutorial on how to add a Facebook Log button, please check if you have followed the same steps to add the video.
    http://tv.adobe.com/watch/learn-adobe-muse-cc/adding-a-facebook-like-button/
    If you have followed the steps correctly and the button still does not work; here is a link to a forum thread which might help solving the issue:
    Facebook Follow Widget not working
    Regards
    Sonam

Maybe you are looking for

  • Menu.ksh

    Hello All, Our existing production system is Sun Solaris 5.5.1. echo $SHELL /bin/cshBut we have menu.ksh script which used korn shell. abc3 69: more menu.ksh #!/bin/ksh #/Scripts/Opers/menu.ksh ........ --- big script Now I am upgrading DB on the new

  • Delay in Olive Tree Bible

    Can anyone tell my why the iTunes App store is dragging it's feet in approving the Olive Tree Bible Software. It is a great app on the iPod, and the folks at Olive Tree have told me they have submitted this app.... but have not been given approval ye

  • [solved] HAL fails repeatedly..

    My HAL is failing on every boot and if I try to start it manually: [shane@Shane-Arch log]$ sudo /etc/rc.d/hal start :: Starting Hardware Abstraction Layer [FAIL] Also... there is something else failing on boot, but it goes too fast.  I can't seem to

  • Dataguard Broker and EBS

    Hi, We've configured dataguard on our system and have been performing manual switchovers (via SQL) smoothly. We would now like to configure Broker for this purpose- via the dgmgrl command line since we don't have 10G Grid. While we're finding immense

  • Netezza to File - drop external table step

    All- I am using IKM netezza to file (external table) for one of my interface. I have customized this IKM by adding the step (drop external table) in beginning and end. After execution there is no drop external table step in the operator log. It is sh