Procedure needed for this scenario

There are three tables.
serial,product and service
some of the fields and how they are related are shown below:
=======================================================
serial               product               service
=======================================================
ip_addr                              item_id
               prod_id(P) --------->     prod_id(F)
                    1-many               
serial_no(P) ---------> serial_no(F)
          1-many
=======================================================
P-Primary Key
F-Foreign Key
=======================================================
relationship between ip_addr and item_id is many-to-many.
based on the item_id we have to categorize ip_addr.
if item_id 684 it is demo a/c
if item_id = 650,652,654,892,894,896,898,900,902,1560,1562,1564,1566,1568,1570
then this is categorized as high rate account.
if it is 644,646 it is stat a/c
other than these item_id are comes under standard a/c
So if a ip_addr has xyz and 684 it should be counted as demo and not standard.
Next you should have for high rate but that units should not have demo.
Next you should have stat a/c but that units should not have high rate and demo
next you should have std a/c but that should not have stat ,high rate and demo.
So, the priority for the account should be demo then high rate then stat then std.
If ip_addr has been categorized to any one of these categories it should not be
processed again.
In other words, ONE IP_ADDR SHOULD ONLY FALL IN ONE OF THE ABOVE CATEGORIES.
The final output should be the no. of ip_addr and the list of ip_addr in each category
namely demo,high rate,stat and std.
Please help me out.
Thanks in advance
~Chandru

To be frank I can't be bothered to create a whole bunch of test data for this, but it has worked with one row in each table :P
SELECT serial.ip_addr, b.cat
FROM serial,
(SELECT a.ip_addr, a.cat, rownum ranking
FROM (SELECT serial.ip_addr
, decode(service.item_id, 684, 'demo'
, 650, 'high rate'
, 652, 'high rate'
, 654, 'high rate'
, 892, 'high rate'
, 894, 'high rate'
, 896, 'high rate'
, 898, 'high rate'
, 900, 'high rate'
, 902, 'high rate'
, 1560, 'high rate'
, 1562, 'high rate'
, 1564, 'high rate'
, 1566, 'high rate'
, 1568, 'high rate'
, 1570, 'high rate'
, 644, 'stat'
, 646, 'stat'
, 'std') cat
FROM service, product, serial
WHERE serial.serial_no = product.serial_no
AND product.prod_id = service.prod_id ) a
ORDER BY decode (a.ip_addr, a.cat, 'demo', 1, 'high rate', 2, 'stat', 3, 4) ) b
WHERE serial.ip_addr = b.ip_addr
AND b.ranking = 1
Cheers, APC

Similar Messages

  • Need inputs from u for this scenario?

    Hi all,
    I have one scenario I need all inputs from u all.
    My scenario is like this.
    I will get data from online transactions I need to collect all the day transaction into one folder and upload them into SAP system at one particular time.
    Which are the best adapters for this scenario.
    If I have standard IDOC I will go with IDOC adapter at receiver side if not proxy.
    But collecting all the data into one folder and schedule the process at particular time.
    How to do this and what are the adapter I can use.
    Thanks and Regards,
    Phani Kumar.

    Hi,
    I hope for online transactions and for tracking it and saving you can write a java script where you can prepare a XML file to get all transactions for particular order and always append it to the end of that xml file. At end of the day you will have a complete transaction list in the XML you are creating. You can use the file name as you desired but i will prefer datewise name.after the completion of that Transaction recording step, put it in some In folder from where your XI system willo take input.
    Now this is file to Idoc scenario or whatever you want to use to post data to SAP Systems. The sechdule this scenario to run in the night or your desired time. After processing the XML file put that file\ to some other complete folder , not to get it again.
    For collection of transactions you can also use databases. Then you scenario will be JDBC to IDOC or the thing you want to post data in SAP system.
    Hope this will help you.
    Regards
    Aashish Sinha
    PS : reward pints if helpful

  • Hi! I can't upgrade my iTunes 10.3.1.55 on my Windows XP 2002 SP3 to the latest version of iTunes. Got the message: "A problem has occured with the Windows Installer-package. A program needed for this installation could not be run." What to do?

    Hi! I can't upgrade my iTunes 10.3.1.55 on my Windows XP 2002 SP3 to the latest version of iTunes. Got the message: "A problem has occured with the Windows Installer-package. A program needed for this installation could not be run." What to do?

    Perhaps let's first try updating your Apple Software Update.
    Launch Apple Software Update ("Start > All Programs > Apple Software Update"). Does it launch and offer you a newer version of Apple Software Update? If so, choose to install just that update to Apple Software Update. (Deselect any other software offered at the same time.)
    If the ASU update goes through okay, try another iTunes install. Does it go through without the errors this time?

  • I have a Mac Pro 4,1 quad core intel Xeon running mac OSX 10.6.8 and I have just moved studios and now need to use the Internet wirelessly but there's no airport facilities on this model can anyone tell me what model of airport card I would need for this

    I have a Mac Pro 4,1 quad core intel Xeon running mac OSX 10.6.8 and I have just moved studios and now need to use the Internet wirelessly but there's no airport facilities on this model can anyone tell me what model of airport card I would need for this mac

    Instead of getting a wireless card for the Mac Pro, you might want to consider getting an 802.11ac wireless bridge device that would enable you to connect more than one device to it by Ethernet cable and to eventually take advantage of the faster 802.11ac wireless standard.

  • Help required specifying Transation attributes for this scenario

    Hi ,
    I am trying to create/update rows in a database using BMP and CMP beans.
    A business method ( Method1 )in session bean calls a non-business method ( Method2) in the same session bean which inturn calls an EntityBean ( EB1-BMP) . EB1 can throw a certain business exception upon which , the Method1 in the session bean calls another EntityBean in a loop( EB2-CMP).
    The problem is that , when the EB1 throws the business exception, i am getting an exception ( part of the stack trace attached below ).
    Could any please explain what should be the transaction attributes to be specified for this scenario.
    Using RequiresNew for the EntityBeans would not work ( or would it ?? ) because the entity bean is being called in a loop and the commit or rollback should happen for all the methods.
    I feel the problem should be solved by specifying the transaction attribute for Method2 ( non business method in session bean ) as Required, but i guess this is not possible.
    How exactly will the transaction behave in this scenario, is the exception caused because EB1 has thrown an exception and i am trying to continue the transaction.
    Could someone please suggest a solution or workaround for this problem.
    Regards,
    Harsha
    ---- Begin backtrace for nested exception
    java.lang.IllegalStateException
    at com.ibm.ws.Transaction.JTA.TransactionImpl.enlistResource(TransactionImpl.java:1694)
    javax.ejb.EJBException: nested exception is: com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@28d16547
    .

    tryout business method ( Method1 )in session bean with transaction as RequiresNew.
    catch exception in Method2 originated from EB1-BMP
    make the method in EB2-CMP as Required/Mandatory
    I have made a guess here so just tryout and let me know if works.
    Its recommend that not to use both BMP's and CMPs in your application. Have any one either.

  • What’s the best practice for this scenario?

    Hi,
    My users want the ability to change the WHERE and/or ORDER BY clause at runtime. They may define user preferences on each screen ( which is bind to a view object). They want to see the same records based on WHERE/ORDER BY defined on the last visit. That is why I keep the users preferences and load the screen based on that, using :
    View.setWhereClause(...);
    View.setOrderByClause(...);
    View.executeQuery();
    This works good when only one user working with the application but faced low performance when more than one user working with the application.
    What are the points to increase the performance and what is the best practice for this scenario?
    Thanks for your help in advance.

    Sung,
    I am talking only about 2 users in my testing. I am sure i missed something but could not recognize that.
    This page is my custom query page including a tag to instantiate app module in stateful mode at the top <jbo:ApplicationModule..> and a tag to instantiate data source <jbo:Datasource...> and release tag at the bottom <jbo:ReleasePageResources..> and some java code in the middle(body). The java code constructed the query statement and then fires the query to set the view object based on the query statement using the above methods.
    So, I am facing very slow performance(speed) when two clients load this page at the same time. Looks like the entire application locks for others when one client load this page and fire the query. i realized the battle neck is where executeQuery() is executing.
    what do you think.
    Thanks in advance for your comments.

  • Hi!  I cant conect The face time betwen my iPad ,iPod and iPhone, please help me,what i need for this issue?

    Hi!  I cant conect The face time betwen my iPad ,iPod and iPhone, please help me,what i need for this issue?

    What is it doing when you try to facetime? also if you are using the same apple Id/email on each device, it wont work.

  • Oracle features available for this scenario

    What is the best methos for replcating oracle database from a production database with every 15 min interval..
    what are the oracle features available for this scenario
    Thanks
    Shiju

    orashiju wrote:
    What is the best methos for replcating oracle database from a production database with every 15 min interval..
    what are the oracle features available for this scenario
    Thanks
    ShijuIs there any specific reason to open a new thread for the same discussion that you have started here,
    Please suggest a suitable method
    Aman....

  • What all is needed for this type of Flash Design Studio

    What all is needed for this type of Flash Design Studio.
    There are a couple of sites out there that use both flash and
    shockwave. I am looking ot get somethign like this started and need
    some help getting pointed in the right direction. here are some
    examples:
    http://www.uberprints.com/studio/
    http://www.customavenue.com/online-design-studio/online-design-studio.html
    https://www.youdesignit.com/youdesignit.cfm
    http://www.pixeltees.com/make

    Rclarkhaddock,
    > What all is needed for this type of Flash Design Studio.
    There
    > are a couple of sites out there that use both flash and
    shockwave.
    Of the examples you showed, I saw Flash (Adobe Flash),
    Shockwave (Adobe
    Director), and JavaScript, but never a combination on the
    same site. (It
    might make sense to combine Flash with JavaScript or
    Shockwave with
    JavaScript, but not really to combine Flash with Shockwave.)
    > I am looking ot get somethign like this started and need
    some help
    > getting pointed in the right direction.
    Any of the above technologies will do it. You could also use
    a Java
    applet or even a .NET solution of some kind, so the choice
    you take will
    depend largely on what platform you want to support and code
    for. This sort
    of project will require significant amounts of custom
    programming. My
    personal approach would be to use Flash, mainly because of
    the popularity of
    the plugin. The Shockwave example looks beautiful, and I
    started out years
    ago using Director, but fewer people nowadays have the
    Shockwave plugin
    installed. It doesn't look like any of the sites shown use 3D
    modeling,
    which is the only relevant feature that Shockwave has over
    the other
    approaches. JavaScript (probably some Ajax approach) would
    work -- as
    seen -- but then you're dealing with compatibility issues
    among various
    JavaScript implementations in the great variety of browsers
    out there.
    Flash minimizes that, in my opinion.
    All you really "need" to produce what you've seen is Flash
    and some sort
    of database back end (MySQL, say), which means you'll need a
    bit of
    middleware (PHP, ASP, Cold Fusion, etc.) to act as your
    ambassador between
    Flash and the database.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • What licensing do I need for this use ?

    Lets say Im planning an application which does nothing but
    allows the user to upload Adobe PDF documents to our server. Then
    once on the server, parse the values from forms on the PDF's and
    extract the data. We wont be distributing Acrobat reader or any
    other Adobe product, but will provide a link where they can
    download the reader.
    Also, the PDF's would be created by someone with a copy of
    Acrobat pro. These PDF's will need digital signature capability.
    Can Acrobat reader handle signatures ?
    Here are my questions:
    - What licensing do I need, if any, in the above scenario,
    other than that for a copy of Acrobat ?
    - What are my options for capturing digitical signatures
    within a PDF and will the publicly available version of Acrobat
    reader allow the end user to sign the documents, provided they
    install the extra requirements for handling the signatures ?

    This isn't the correct forum for this topic, but I may be
    able to get you started...
    The licensing restrictions on gathering form data from PDFs
    is outlined in the EULA for Reader, I believe there is a limit of
    500 copies, but I could be wrong ... you should look at the EULA to
    be sure.
    Beyond that, try posting to the
    Acrobat
    Forums or contacting a sales rep at Adobe, they may be able to
    advise you further.

  • Programming logic for this scenario

    hi all,
    kindly help me with this scenario:
    i have a internal table with fields like this (among others)
    OBJEK                        ATINN         CHAR                                  CHARG            CHAR1
    000000000000000031 0000000188  Batchnumber: WEEK NO. 9  0000000052
    000000000000000031 0000000189  Visualinspection: OK            0000000052
    now wht i need to do is for SAME batch number i need to concatenate the values of CHAR into CHAR1.
    that is to say that CHAR1 shud have the value "Batchnumber: WEEK NO. 9 Visualinspection: OK"
    ive right now done it using 2 different internal tables and concatenating the values. want to know if theres an easier and simpler way.
    any pointers guys??
    pk

    solved it myself
    thanks to sujatha reddy's post in the following thread:
    Re: at end of  statement
    pk
    Edited by: prashanth kishan on Jul 11, 2008 9:19 AM

  • What is the best Skype setup for this scenario?

    I live in the United States and about to be deployed to Afghanistan for about one year.  I will have a laptop and an International capable Android phone, both with Skype software installed.  I want to be able to use Skype to Skype via the laptop, and also be able to call both landlines and cell phones in the United States while I am in Afghanistan.  What would be the best Skype subscription plan in this scenario to keep costs to a minimum.

    Hi,
    As you probably know, Skype to Skype calls are free, but if you wish to call phones then you would need a subscription that covers calling destination.
    You might find Unlimited US&Canada subscription from: http://www.skype.com/go/subscriptions
    Fair usage policy applies, but 6hours per day should be more than enough to call your family and friends back home in US.
    http://www.skype.com/go/terms.fairusage
    Skype also offers Online Numbers for US. For example if you purchase an Online Number in US then your friends who don't have Skype can call that number. They will be charged with local rates and call will be directed to your Skype account when you are online on your phone or laptop.
    Tip: If you do decide to purchase an Online Number for 12months then purchase calling subscription first and you will get 50% discount on Online Number.
    https://support.skype.com/en/faq/FA331/What-is-an-Online-Number
    Andre
    If answer was helpful please mark it with Kudos and if issue is resolved mark it with solution. This will help other users find this answer more easily. Thanks in advance!

  • What Permission Set Is Required For This Scenario?

    Hello,
    I currently have an environment where I have limited users to being able to create/delete databases that only they have created.  I did this by creating a Login with Public access and granting them the  CREATE ANY DATABASE permissions to their
    login. This works great as the users can create a database and delete their database but not anyone else's. The issue I have is the following scenario:
    Database A is backed up from Server 1 (a different server than the restore server) and the DB was created by User 1
    Database A is restored to Server 2 by User 2 who has CREATE ANY DATABASE permission (successfully).
    User 2 can see the restored database, but cannot access it: The database is not accessible error.
    When I view the database I see that the DB Owner is listed as User 1.
    I've been trying to figure out how to be able to allow the user to become the new owner so they can edit/delete the database, but still not affect other databases that they do not own.
    I've played with various permission sets but they end up being able to delete other user databases which I'm trying to avoid.  I also don't want to have to change the owner myself. 
    Is there a permission set that I can grant that will allow this scenario?

    That's a valid statement, let me explain my scenario and perhaps there is a better way to construct what I'm after.
    I have a QA server where different developers create databases.  All the databases backed up on the QA server are stored in a shared folder.  This shared folder is accessible on our DEV server.  We have a different set of developers
    who at times need to restore one of the QA backups on the DEV server for different testing reasons.  The permission set applied was simply to prevent someone from accidently deleting someone else's database.  Restoring someone else's database in
    our environment is not a concern.
    With this in mind, I was hoping there was an additional permission I could grant that would allow the user restoring the database to become the new owner. I don't want the burden of approving it as it will always be approved.
    I clicked on the connect link, but it returns as invalid -
    The system has encountered an
    unexpected error. We apologize for the inconvenience. The issue will be
    addressed as quickly as possible.

  • Want help in deciding the method of development for this scenario

    Hi,
    My requirement is to create one screen where customer enters shipment #, and ship-to information and say continue, he will be shown another screen with shipment details, and combo box to select appointment time. when he clicks on Make Appointment button of this screen, he needs to be shown confirmation screen with the appointment information being stored in sap tables. I want to know the best method of creating this peice of application. If you have any question, please feel free to ask them.
    Thank you,
    Surya

    Hi Surya,
    Just develop a small ALV for this application. It will best suite to your scenario.If you know to develop ALV using OO then its very simple, or you can just search throgh the SDN you will find lots of sample code to do the same.
    Regards,
    Atish

  • What SQL query I need for this?

    I need to execute a SQL query but I don't know how.
    To illustrate it, please take a look at some example data:
        ARTICLEID SOLDON    
        1         2005-12-31
        1         2005-11-31
        1         2005-10-31
        1         2005-09-31
        1         2005-08-31
        1         2005-07-31
        1         2005-06-31
        1         2005-05-31
        1         2005-04-31
        1         2005-03-31
        1         2005-02-31
        1         2005-01-31
        1         2004-12-31
        1         2004-11-31
        2         2005-12-31
        2         2005-11-31
        2         2005-10-31
        2         2005-09-31 This is a piece of the sales data for the articles (sales history).
    Lets assume that today is the date 2005-12-31.
    Two requirements for the query:
    1. Get the sales data for the last 12 months.
    2. Get only the sales data for articles where there is sales data since at least 6 months.
    The result in my example should look like this:
        ARTICLEID SOLDON    
        1         2005-12-31
        1         2005-11-31
        1         2005-10-31
        1         2005-09-31
        1         2005-08-31
        1         2005-07-31
        1         2005-06-31
        1         2005-05-31
        1         2005-04-31
        1         2005-03-31
        1         2005-02-31
        1         2005-01-31 What is the SQL which I need to accomplish this query?

    To get all the information from the last 12 months
    you will have to use date manipulation.
    SELECT add_months(sysdate, -12) from
    dual;This gives you the date 12 months ago.
    So you will have to select your date between then and
    the current date.If I do this I will get this data:
        ARTICLEID SOLDON    
        1         2005-12-31
        1         2005-11-31
        1         2005-10-31
        1         2005-09-31
        1         2005-08-31
        1         2005-07-31
        1         2005-06-31
        1         2005-05-31
        1         2005-04-31
        1         2005-03-31
        1         2005-02-31
        1         2005-01-31
        2         2005-12-31
        2         2005-11-31
        2         2005-10-31
        2         2005-09-31 But I want this data:
        ARTICLEID SOLDON    
        1         2005-12-31
        1         2005-11-31
        1         2005-10-31
        1         2005-09-31
        1         2005-08-31
        1         2005-07-31
        1         2005-06-31
        1         2005-05-31
        1         2005-04-31
        1         2005-03-31
        1         2005-02-31
        1         2005-01-31 I am no native English speaker. What didn't you understand in the two requirements?
    Here are my two requirements for the query:
    1. Get the sales data for the last 12 months.
    2. But get ONLY the sales data for articles where there is sales data since AT LEAST 6 months.
    The result can contain as many IDs as you want if the two requirements are met. Its not a trivial SQL statement for me. Please remember that the above data are only for illustration. They are just an example.
    There should be a SQL statement for this.
    Please tell me if you don't understand my problem. I will try to explain it in a better way if I can.

Maybe you are looking for

  • USB flash memory: "application not found" error

    When recently trying to use a USB flash memory stick I was getting an "f:\ application not found" error. I tried all kinds of fixes from Microsoft. Turns out it was caused by Lightroom. Since the memory stick had photos on it, my computer's Autoplay

  • Form on screen, not updating for new data on inputstream

    I'm writing a j2me midlet that will initiate a bluetooth connection to another device. I have been able to set up the inputstreams and outputstreams and send some data between the two devices using serial port emulation. The following is the code for

  • What SSD does Apple put in the MBP 13"?

    From a couple threads it sounds like they use the Toshiba SSD. Is this true? According to a couple test web sites the Toshiba drive is one of the slowest (like half the speed of most of the drives).

  • Safari 3.0.4 won't let me save downloaded mpegs

    I just installed OS 10.4.11 and upgraded Safari to 3.0.4 as part of the bargain. But now when I try to save downloaded mpegs I get nothing but an error beep when I attempt to save by keystrokes, and the pull down menu from File no longer gives me a S

  • Service Organization in Complaints

    Hi, We are creating complaints in CRM, while creating system asking to enter the service organization. We are satisfied with sytesm using sales organization alone,not maintaing service organization and we don't want to maintain Service Org. how do we