A real noodle-scratcher SELECT problem...  :)

Hi. I'm hoping someone can help me with a little problem I have:
Here's the raw data I have:
TABLE: MYDATA
PHASE | CONTRACT_NAME | PLAN_CRITERIA | AMOUNT
1 | STAIRS CONTRACT | 2% | 900
1 | FINISH CARPENTRY | 2A | 1000
1 | FINISH CARPENTRY | 2B | 1100
1 | FINISH CARPENTRY | 2C | 1200
Here's what I want as a sql result:
PHASE | CONTRACT_NAME | PLAN_CRITERIA | AMOUNT
1 | STAIRS CONTRACT | 2A | 900
1 | FINISH CARPENTRY | 2A | 1000
1 | STAIRS CONTRACT | 2B | 900
1 | FINISH CARPENTRY | 2B | 1100
1 | STAIRS CONTRACT | 2C | 900
1 | FINISH CARPENTRY 2C | 1200
I can't change the raw data, but I need a dynamic result (based on a sql statement) that uses the '%' wildcard and explodes the missing rows.
Stairs has a 2% plan criteria and Finish Carpentry shows it has plans 2A, 2B, and a 2C. Because of the match between 2% and 2A, 2B, 2C; I want to repeat the Stairs row for each matching Finish Carpentry row.
I hope this makes sense and someone can help me out. I'd sure appreciate it and it'd practically GUARANTEE a Christmas card for the kind soul who can come up with the solution. :)
Thanks!
Steve

I'm not sure if this works well the way you want it and I'm sure there are better solutions, but can give you an idea where to start.
PLEASE TEST IT,
SQL> l
  1  WITH t AS
  2       (
  3  SELECT 1 AS phase, 'STAIRS CONTRACT' contract_name, '2%' plan_criteria ,900 amount FROM DUAL
  4           UNION ALL
  5           SELECT 1, 'FINISH CARPENTRY', '2A', 1000 FROM DUAL
  6           UNION ALL
  7           SELECT 1, 'FINISH CARPENTRY', '2B', 1100 FROM DUAL
  8           UNION ALL
  9     SELECT 1, 'FINISH CARPENTRY', '2C', 1100 FROM DUAL
10           UNION ALL
11           SELECT 1, 'FINISH CARPENTRY', '2D', 1200 FROM DUAL
12     UNION ALL
13     SELECT 1, 'FINISH CARPENTRY', '5D', 1200 FROM DUAL
14     UNION ALL
15     SELECT 1, 'TEST CARPENTRY', '2X', 1200 FROM DUAL)
16  SELECT *
17    FROM (SELECT t.phase, t.contract_name, t2.plan_criteria
18                ,DECODE (t.plan_criteria, t.plan_criteria, t.amount, t2.amount)
19            FROM t, t t2
20           WHERE t2.plan_criteria LIKE t.plan_criteria)
21   WHERE plan_criteria <> '2%'
22*  order by plan_criteria,contract_name
SQL> /
     PHASE CONTRACT_NAME    PL DECODE(T.PLAN_CRITERIA,T.PLAN_CRITERIA,T.AMOUNT,T2.AMOUNT)
         1 FINISH CARPENTRY 2A                                                       1000
         1 STAIRS CONTRACT  2A                                                        900
         1 FINISH CARPENTRY 2B                                                       1100
         1 STAIRS CONTRACT  2B                                                        900
         1 FINISH CARPENTRY 2C                                                       1100
         1 STAIRS CONTRACT  2C                                                        900
         1 FINISH CARPENTRY 2D                                                       1200
         1 STAIRS CONTRACT  2D                                                        900
         1 STAIRS CONTRACT  2X                                                        900
         1 TEST CARPENTRY   2X                                                       1200
         1 FINISH CARPENTRY 5D                                                       1200
11 rows selected.

Similar Messages

  • Selection Problem with JTable

    Hello,
    i have a selection problem with JTable. I want to allow only single cell selection and additionally limit the selection to the first column.
    I preffered the style from MS Outlook Express where you can select the email accounts to edit.
    It is a table like this:
    Account name  |   Type  |   ...
    --------------|---------|---------------------
    Hotmail       |   POP3  |
    GMX           |   IMAP  |The selection should be only avaibable at 'Hotmail' or 'GMX' - not at 'POP3', 'IMAP' or as complete row selection.
    Please help me!
    Thanks.
    Warlock

    Maybe this will helpimport java.awt.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        String[] head = {"One", "Two"};
        String[][] data = {{"R1-C1", "R1-C2"}, {"R2-C1", "R2-C2"}};
        JTable jt = new JTable(data, head);
        jt.getColumnModel().setSelectionModel(new MyTableSelectionModel());
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        jt.setCellSelectionEnabled(true);
        jt.setRowSelectionAllowed(false);
        jt.setColumnSelectionAllowed(false);
        setSize(300, 300);
        setVisible(true);
      public static void main(String[] arghs) { new Test3(); }
    class MyTableSelectionModel extends DefaultListSelectionModel {
      public void setSelectionInterval(int index0, int index1) {
        super.setSelectionInterval(0, 0);
    }

  • Select Problem For 'Back Menus' - Zen V P

    Just got the Zen V Plus and tried to set the time/date. Followed the 'guide' and after the time/date screen pressed the 'back button'. Got the Set Alarm/Date/Time (etc) menu but when I selected an option (moved joystick down to desired option then pressed the joystick) the time/date display came up and I was NOT ABLE to set the date. Same thing occurred trying to set the date (tried it several times and it worked once .... then attempted again - several times (4) but it only worked once). Turns out I have the same problem with any option in ANY 'back' menu. Suggestion?
    Do I have a defecti've unit (can't be the 'operator' who is defecti've! haha)? Should I return it and try another?
    Actually not that interested in playing music .... it's more for playing .wma(DRM) book files.

    Latest ... updated my firmware (to ZENVPlus_PCFW_P4S_L2___0.exe) and it fixed the select problem for SET DATE/TIME etc however
    the SELECT procedure doesn't always work for 'back button' menus. Example: tried to set a bookmark... following procedure in 'guide', pressed 'back button' and held it, from 'NOW PLAYING' screen - works 2 out of 5 times. Most of the time, pressing and holding takes you back to the previous menu - not to the 'back' (or in this case the SET BOOKMARK) menu. Sounds like something for the next version of firmware ... the code doesn't always set an internal timer correctly (am a programmer of 30 years ... part of that time pgmmng firmware).

  • Print selection problem

    when i select a page to be print from my pc the page select in

    Hello. I feel your pain and frustration with the print selection problem in safari, especially in Snow Leopard. I have spent hours trawling help pages and forums etc. BUT YEE HAA (sorry got a bit excited, but it really was hours) I found the answer. So here goes.
    Click on Safari
    Scroll down to services then slide to right
    Scroll down to services preferences and click
    Scroll down to the Text section
    If you Tick the Text box it will choose all options for you. Or if you don't want all options in the Text list, then untick Text box and tick options you do want.
    BUT for your print selection problem make sure you tick NEW TEXT EDIT WINDOW CONTAINING SELECTION.
    Then when you want to select something in a web page you want to print (including pictures etc) then highlight it, then Right click. And low and behold, in the list is NEW TEXT EDIT WINDOW CONTAINING SELECTION. Click that, Then press cmd+p and your printing.
    I really hope that helps with your problem
    I can now go to sleep.

  • At Line selection problem

    hi,
    iam stuck up with AT LINE-SELECTION problem ie i designed a screen where they need month list on clicking F4. i got the month list using month_names_get in the screen but while clicking the relevant month no.it's not entering into the required parameter. i have attached the codings,
    MODULE MONTH_DIS OUTPUT.
      SUPPRESS DIALOG.
      LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
      SET PF-STATUS SPACE.
      NEW-PAGE NO-TITLE.
      WRITE:/ 'SELECT MONTH' COLOR COL_HEADING.
      ULINE.
      DATA: T_MNTH LIKE T247 OCCURS 12 WITH HEADER LINE.
      refresh t_mnth.
      CALL FUNCTION 'MONTH_NAMES_GET'
       EXPORTING
         LANGUAGE                    = SY-LANGU
    IMPORTING
      RETURN_CODE                 =
        TABLES
          MONTH_NAMES                 = T_MNTH
       EXCEPTIONS
         MONTH_NAMES_NOT_FOUND       = 1
         OTHERS                      = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      loop at t_mnth.
        write:/ t_mnth-mnr, t_mnth-ltx.
      endloop.
      CLEAR T_MNTH-MNR.
    ENDMODULE.                 " MONTH_DIS  OUTPUT
    AT LINE-SELECTION.
      p_period = t_mnth-mnr.
      CHECK NOT p_period IS INITIAL.
      LEAVE TO SCREEN 0.
    here in the AT LINE-SELECTION, the selected month is not coming to the required parameter.
    pls help me in this issue,
    Thanks in advance,
    Premnath.

    You need to set a "Hide" after the write... I suggest you also set your own dialog PF-STATUS too so you can have just a PF2 "pick" button and a Cancel button ( this will look better to the user).
    loop at t_mnth.
      write:/ t_mnth-mnr, t_mnth-ltx.
      hide: t_mnth.  "needs this
    endloop.
    clear: t_mnth.

  • Weird BGP path selection problem

    Hi, all,
    I am seeing a weird BGP path selection problem on 4948 switch running cat4500-entservicesk9-mz.122-46.SG.bin code, this switch has two uplinks to the same ISP's different edge router, one circuit is primary the other one is strict backup, only default route is accepted from ISP. I am setting both local preference and weight to the default route advertised over backup link, however neither one is taking effect, BGP still thinks the backup link is better, what could be wrong?
    rtr#sh ip bgp 0.0.0.0/0
    BGP routing table entry for 0.0.0.0/0, version 105
    Paths: (3 available, best #2, table Default-IP-Routing-Table, not advertised to EBGP peer)
      Not advertised to any peer
      17675, (received & used)
        203.169.8.37 from 203.169.8.37 (61.211.160.150)
          Origin IGP, localpref 100, valid, external
          Community: 65001:0 no-export
      17675
        203.169.8.45 from 203.169.8.45 (61.211.160.151)
          Origin IGP, localpref 90, weight 90, valid, external, best <====
          Community: 65001:0 no-export
      17675, (received-only)
        203.169.8.45 from 203.169.8.45 (61.211.160.151)
          Origin IGP, localpref 100, valid, external
          Community: 65001:0 no-export
    Thanks

    Hi,
    On cisco routers , weight is having highest preference to decide best path. By default for received route, weight is 0 but you are setting weight 90 to backup path and that is why it is getting preferred (higher is better). Please remove weight and let local preference be 90 (lesser than route on primary path)
    --Pls dont forget to rate helpful posts--
    Regards,
    Akash

  • Certificate selection problem in Safari

    Hi ,
    I have certifcates A,B,C,D for the same site , whenever i use the Mozilla it is asking which one to select , but somehow i dont know why Safari is asking the same option.
    It is forcing me to accept Certifcate A to that paricular site. How to solve this problem in safari.
    Regards
    Vikranth

    Hello. I feel your pain and frustration with the print selection problem in safari, especially in Snow Leopard. I have spent hours trawling help pages and forums etc. BUT YEE HAA (sorry got a bit excited, but it really was hours) I found the answer. So here goes.
    Click on Safari
    Scroll down to services then slide to right
    Scroll down to services preferences and click
    Scroll down to the Text section
    If you Tick the Text box it will choose all options for you. Or if you don't want all options in the Text list, then untick Text box and tick options you do want.
    BUT for your print selection problem make sure you tick NEW TEXT EDIT WINDOW CONTAINING SELECTION.
    Then when you want to select something in a web page you want to print (including pictures etc) then highlight it, then Right click. And low and behold, in the list is NEW TEXT EDIT WINDOW CONTAINING SELECTION. Click that, Then press cmd+p and your printing.
    I really hope that helps with your problem
    I can now go to sleep.

  • Scratch Disk Problems - Too much hard disk space?

    Now, here's a question for scratch disk problems. My photoshop (7) used to work (on my old computer), now I've re-installed it and it says it and windows are paging to the same location, and I can't open it because "Scratch disks are full." I know there are lots of questions like this, but this one is special. I believe the problem is I have 1.5 TB of hard disk space, which apparently is too much and causes problems (?). Anyway, I would change the scratch disk location but I can't open photoshop in order to do so. Any suggestions?
    Basically, is there a way for me to change scratch disk locations if Photoshop won't even open?
    Any help would be much appreciated. Thanks!

    Changing the location won't do anything nor will resetting the prefs (sorry Manish-Sharma). You really need to physically downsize the partition to be below or around the 500GB ceiling. It's unavoidable as this is inherent in the old file I/O API that those programs use. Changing the scratch disk location would do nothing as long as the program partition is stil lthat large and throws the program through a loop. open your drivemanagemnt by using My Computer --> Right-click --> Manage --> Disk Management and split the partition or whatever.
    Mylenium

  • Browser selection problems

    In my laptop I had started with 10.2 and then upgraded to 10.4 skipping 10.3. In an effort to solve some other issues with burning dvds on teh adivice of a Mac genuis.
    Well while doing the upgrade and installing everything all over from scratch 10.2 thru 10.4 to install my base programs after I wiped my HD for the virgin installs I installed AOL my main brower and for teh first time even got it right where the Modem counter clock shows up in the menu bar when using the modem to log on. (I am in a area and stuck on dial up).
    Well turned out that it appears that it was either my Mother board or drives tha where causing my problems as I had sent out my laptop thru the apple store for repairs and afetr a 2 moths nitemare they gutted my machine and in the process thet trashed my HD. I had all basic files on back up no loss but a pain to reinstall everything, this this time though 10.4 was installed direct and not upgraded thru 10.2 install with the Startup disk that came with the G4 powerbook.
    Well somewhere along this path AOL is no longer my default browser, Safari comes up when a link is clicked in a outside file plus in the menu bar the modem clock no longer counts the online connection when in AOL.
    I can log on and dial up ok thru AOL but sometimes causes problems when in other programs and you click on say a link and the system keeps trying to go thru Safari.
    I have gone into preferences and clicked on AOL dial up and tried that, followed the AOL instructions fro install and setup which worked before APPLE service gutted my mac. Tried various settings but can't seem to change to AOL as the main browser.
    About the only thing I haven't done is uninstall safari and reboot.
    I normally have AOL, Safari and Firefox as my browser internet connection in that order of priority, which is my preference, any suggestions?

    Hi Don!
    I'm no longer using Dial-Up, but I hope I can still assist you.
    Are you using AOL For Mac OS X Version 10.3.7 (Revision 4136.xxx (US))?
    "...other programs and you click on say a link and the system keeps trying to go thru Safari..."
    Which other programs, and where do the links lead to?
    "...I have gone into preferences and clicked on AOL dial up..."
    Where did you select this?
    Compare the Network Preferences to the ones below.
    I can only show you, how I had mine set, when using the Apple Internal Modem with Dial-Up, on an iMac G3 running Panther 10.3.9, but they should be the same for Tiger.
    NETWORK/INTERNET SYSTEM PREFERENCES (Apple Internal Modem Using Dial-Up) Adjustments may be necessary for different Mac models, systems, and connection method.
    While AOL is not loaded, go to:
    System Preferences > Network > Location: Select Automatic
    Show: Select Internal Modem Or however you connect
    On the PPP screen, click PPP Options. Check ONLY
    Disconnect when user logs off
    On the TCP/IP screen, Configure using IPv4: Select Using PPP
    On the Modem screen, Select your modem from the list. I'm using an iMac (Summer 2001), and I have Apple Internal 56K Modem (v.90) selected.
    Check Enable error correction and compression in modem
    Wait for dial tone before dialing
    Show modem status in menubar This one isn't necessary, I just like it there!
    Also select your Country.
    Then, Location: Automatic
    Show: Network Port Configurations
    Make sure Internal Modem, or however you connect, is checked and at the top of the window.
    Click Apply Now at the bottom of the screen.
    ali b

  • How do i get to talk with a real person about my problem?

    I am thoroughly frustrated trying to navigate all this troublehooting nonsese online by myself. i paid for a product that is not working. how do i speak with a real person who can answer my questions???????

    Hi,
    You may contact HP support via Phone, email or live chat.
    Select your country below, then follow Technical support after you buy to get the contact details.
    http://www8.hp.com/us/en/contact-hp/ww-contact-us.html
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Install real time 8.6 problems

    Hello all,
    I´m trying to install Real Time 8.6 on a Desktop target. I ran the verification tool and it says that it´s a compatible target.
    I created the Desktop PC utility usb drive and formatted the target with no problems.
    When I restarted the PC the network card was initialized with the following address: 169.254.81.194 and it doesn´t show up on MAX.
    It should have started with 0.0.0.0 so that we could then configure the IP Address.
    Am I doing something wrong?
    thanks,
    Adam
    Solved!
    Go to Solution.

    Hi Maxime,
    First I was installing the real time on a desktop connected with a cross over cable and when I tried to see the target on MAX it didn´t show up.That was when I posted this question here.
    This morning I started from scratch and instead of connecting directly using a cross over cable I connected the target to our LAN. The IP address was the same but I was able to change it.
    However I have some questions:
    In Labview 8.5.1 (in this same target) when I installed real time the default IP was 0.0.0.0. Has this changed?
    I tried (with Labview 8.6) to change the IP to 10.0.0.100 and connect to it using the cross over it responded to ping but did not show up in MAX. Any ideas why?
    Network interface: 10/100 Base-T Intel® 82562.
    No error apears on the screen of the target. 
    Thank you,
    Adam

  • Scratch Disk Problem

    I am running Audition 2 and cannot get preferences to recognize the second internal drive (D:) for use as a scratch disk.
    Only the C: drive and the external F: drive come up.
    This is a recent problem. There is nothing wrong with the D: drive: it has 150 GB free.
    Oddly, this problem also affects Soundbooth CS4, but none of the other CS3 or CS4 apps (Photoshop, Premiere, Illustrator...)
    I've tried restarting. Is there any way to throw away the preferences files for both Audition 2 & Soundbooth? Do I need to reinstall?
    System: Windows XP Pro SP3 3 GB RAM
    Drives: C:150 GB (internal) D: 250 GB (internal) F:1 TB (external)
    Thanks,
    Felicia Lovelett

    Felicia Lovelett wrote:
    I've tried restarting. Is there any way to throw away the preferences files for both Audition 2 & Soundbooth? Do I need to reinstall?
    System: Windows XP Pro SP3 3 GB RAM
    Drives: C:150 GB (internal) D: 250 GB (internal) F:1 TB (external)
    Hmm.... the available drive preferences aren't stored by Audition, but are gathered on the spot from the OS when the function is called. So when you select the three dots to set the temp folders, you aren't looking at Audition at all, but the OS. On the face of it, this isn't an Audition problem at all, especially if other apps aren't finding it either.
    There are several possibilities, but without looking at your system I don't think that any of us would actually be able to say definitively what's causing this. Quite often D drives are non-writable - because they are generally CD or DVD drives. But that shouldn't affect what Audition sees, or is reported by the OS at all - it should only list writable drives, but it should certainly list all of them! The only thing that I can think of that you could try easily is to change the drive letter for your second drive to something completely different (try Q), and see if Audition/SB see it then. Look at http://support.microsoft.com/kb/307844 for more information about this.

  • Selection problem on ADRC Table.

    Dear Exparts.
    please see the Query:
    select country city1 from adrc
      into CORRESPONDING FIELDS OF wa_country
      where
    country = p_country
      and
    city1 = p_city.
      append wa_country to it_country.
      endselect.
    In this selection, when I send p_country = AE and p_city = Dubai I cannot get any data. But there have data In DB.
    But when I send p_country = DE and p_city = Berlin I can get porper data.
    Can anybody solve this problem.
    Your regards
    rayhan

    Just paste the below code and check either getting value or not
    DATA wa_country TYPE adrc.
    PARAMETERS: p_city TYPE adrc-city1 DEFAULT 'Dubai',
                p_countr TYPE adrc-country DEFAULT 'AE'.
    SELECT SINGLE * FROM adrc INTO wa_country WHERE country = p_countr
    AND city1 = p_city.
    IF sy-subrc = 0.
      WRITE : / wa_country-city1, / wa_country-country.
    ENDIF.
    Kanagaraja L

  • Selection problem in JTable

    Hello everyone,
    I've a JTable,which I'm rendering using my own renderer.When the background of any cell within the table is rendered,that particular row does not get highlighted on mouseclick.However,when only the foreground is set (without setting the background),the row is highlighted.Can anyone suggest anything on this problem.I want the row to be highlighted on mouse click even if the background of the cell is rendered.
    thanx in advance.
    J.C

    Maybe u can use this, but you might want to extend your cell renderer.
    [qouote from API docs]
    setSelectionBackground
    public void setSelectionBackground(Color selectionBackground)
    Sets the background color for selected cells. Cell renderers can use this color to the fill selected cells.
    The default value of this property is defined by the look and feel implementation.

  • Selection problem in a JList !!!!

    I am using a JList and on the selection of an item in this JList - I enable and disable some buttons.
    I have currenlty added a ListSelectionListener that allows me to trap the valuechanged event and thus if any item in the list is selected / deselected, i can enable/ disable the buttons.
    Now the abuv works fine with click and Ctrl clicking (to deselect),
    However if i come into the JList from another control (a JCombo) by tabbing and then use the arrow keys once the control is in the JList, the up and down arrow keys allow me to change the selection in the list.
    But, the valueChanged event does not come in the above case and hence the buttons do not enable/disable !!!
    Can you tell me what can be the problem?????

    Add a key listener and handle the KeyEvent
    Sachin

Maybe you are looking for

  • My time capsule is definetly slow

    Hello all! I just bought a 1TB time, very nice item, but I'm really upset for its performances, it's really too slow. I warmly hope it's cause my configurations otherwise I've to return it to apple so I hope I can get some good suggestion from you sk

  • Help: Hotmail messages won't delete in Mail

    I've had this super annoying problem since I installed Leopard: whenever I receive a message on my hotmail account, it's impossible to delete, and it will keep showing up as unread everytime I throw it in the trash, until I finally delete it in my ho

  • Unable to search for emails on webmail

    we have a single user who is unable to search emails from web-mail . whenever try to search emails using any keywords on web-mail it returns no results. Please suggest. Aditya Mediratta

  • Ethernet problems installing Solaris 10 on Ultra 5

    I am trying to install on a Sun Sparc Ultra 5 which I have inherited. The machine booted up OK with Solaris 7 with the old user's set up, but I do not have his ids or passwords. When I try to install Solaris 10, early in the boot it comes up with "at

  • Regarding loop statement

    hi, how to find whether a statement exists between loop and endloop. for eg:           loop at itab.           clear.....            endloop. want check whether clear statement exists between loop. Thanks