I need help on This SQL problem ASAP :)

Hi All,
I need help on this....
I have a table...
Say table name: one
with these values
premnum status
1234 C
1234 F
1234 P
1234 F
5678 C
5678 F
5678 P
9112 C
9112 F
9112 P
9112 F
3456 C
3456 F
3456 P
7890 C
7890 P
7890 F
Now, I want to output only those premnum with status = 'C' and those premnum with Status 'F' having a count > 1 (with two status = 'F')
So the output would be something like this
premnum status
1234 C
1234 F
1234 F
5678 C
9112 C
9112 F
9112 F
3456 C
7890 C
I really need help on this asap...
I need the SQL statement on this....
Thank you in advance. :)
Edited by: 804697 on Oct 23, 2010 9:45 PM

Hi,
you can use the following query.
CREATE TABLE PREM_TEST ( premnum NUMBER , STATUS VARCHAR2(1));
INSERT INTO PREM_TEST VALUES(1234 ,'C');
INSERT INTO PREM_TEST VALUES(1234 ,'F');
INSERT INTO PREM_TEST VALUES(1234 ,'P');
INSERT INTO PREM_TEST VALUES(1234 ,'F');
INSERT INTO PREM_TEST VALUES(5678 ,'C');
INSERT INTO PREM_TEST VALUES(5678 ,'F');
INSERT INTO PREM_TEST VALUES(5678 ,'P');
INSERT INTO PREM_TEST VALUES(9112 ,'C');
INSERT INTO PREM_TEST VALUES(9112 ,'F');
INSERT INTO PREM_TEST VALUES(9112 ,'P');
INSERT INTO PREM_TEST VALUES(9112 ,'F');
INSERT INTO PREM_TEST VALUES(3456 ,'C');
INSERT INTO PREM_TEST VALUES(3456 ,'F');
INSERT INTO PREM_TEST VALUES(3456 ,'P');
INSERT INTO PREM_TEST VALUES(7890 ,'C');
INSERT INTO PREM_TEST VALUES(7890 ,'P');
INSERT INTO PREM_TEST VALUES(7890 ,'F');
SELECT     PREMNUM , STATUS
FROM     PREM_TEST
WHERE     STATUS = 'C'
OR          (PREMNUM , STATUS ) IN (     SELECT PREMNUM , STATUS
                                             FROM     PREM_TEST
                                             WHERE     STATUS = 'F'
                                             GROUP BY PREMNUM , STATUS
                                             HAVING COUNT(*) > 1
PREMNUM S
1234 C
1234 F
1234 F
5678 C
9112 C
9112 F
9112 F
3456 C
7890 C
9 rows selected.

Similar Messages

  • Pls i need help for this simple problem. i appreciate if somebody would share thier ideas..

    pls i need help for this simple problem of my palm os zire 72. pls share your ideas with me.... i tried to connect my palm os zire72 in my  desktop computer using my usb cable but i can't see it in my computer.. my palm has no problem and it works well. the only problem is that, my  desktop computer can't find my palm when i tried to connect it using usb cable. is thier any certain driver or installer needed for it so that i can view my files in my palm using the computer. where i can download its driver? is there somebody can help me for this problem? just email me pls at [email protected] i really accept any suggestions for this problem. thanks for your help...

    If you are using Windows Vista go to All Programs/Palm and click on the folder and select Hot Sync Manager and then try to sync with the USB cable. If you are using the Windows XP go to Start/Programs/Palm/Hot Sync Manager and then try to sync. If you don’t have the palm folder at all on your PC you have to install it. Here is the link http://kb.palm.com/wps/portal/kb/common/article/33219_en.html that version 4.2.1 will be working for your device Zire 72.

  • I need help with this script please ASAP

    So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
    The script (Sorry if it's a bit long):
    #------------Startup-------------
    display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
    set Lolz to (button returned of the result)
    if Lolz is "Cyaaaa" then
    killapp()
    else if Lolz is "Take the Quiz" then
              do shell script "say -v samantha Ok starting in 3…2…1…GO!"
    #------------Question 1-----------
              display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
              set A1 to (button returned of the result)
              if A1 is "Apprentices" then
                        do shell script "say -v samantha Correct Answer"
              else
                        do shell script "say -v samantha Wrong Answer"
      #----------Question 2--------
                        display dialog "Most children were taught
    to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
                        set A2 to (button returned of the result)
                        if A2 is "Bible" then
                                  do shell script "say -v samantha Correct Answer"
                        else
                                  do shell script "say -v samantha Wrong Answer"
      #------------Question 3---------
                                  display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
                                  set A3 to (button returned of the result)
                                  if A3 is "Great Awakening" then
                                            do shell script "say -v samantha Correct Answer"
                                  else
                                            do shell script "say -v samantha Wrong Answer"
      #-----------Question 4--------
                                            display dialog "_______ was
    a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
                                            set A4 to (button returned of the result)
                                            if A4 is "Ben Franklin" then
                                                      do shell script "say -v samantha Correct Answer"
                                            else
                                                      do shell script "say -v samantha Wrong Answer"
      #----------Question 5-------
                                                      display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
                                                      set A5 to (button returned of the result)
                                                      if A5 is "Land" then
                                                                do shell script "say -v samantha Correct Answer"
                                                      else
                                                                do shell script "say -v samantha Wrong Answer"
      #---------Question 6--------
                                                                display dialog "The first step toward guaranteeing these rights came in 1215. That
    year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
                                                                set A6 to (button returned of the result)
                                                                if A6 is "Magna Carta" then
                                                                          do shell script "say -v samantha Correct Answer"
                                                                else
                                                                          do shell script "say -v samantha Wrong Answer"
      #----------Question 7--------
                                                                          display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
                                                                          set A7 to (button returned of the result)
                                                                          if A7 is "Parliament" then
                                                                                    do shell script "say -v samantha Correct Answer"
                                                                          else
                                                                                    do shell script "say -v samantha Wrong Answer"
      #--------Question 8-----
                                                                                    display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
                                                                                    set A8 to (button returned of the result)
                                                                                    if A8 is "King James II" then
                                                                                              do shell script "say -v samantha Correct Answer"
                                                                                    else
                                                                                              do shell script "say -v samantha Wrong Answer"
      #--------Question 9------
                                                                                              display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
                                                                                              set A9 to (button returned of the result)
                                                                                              if A9 is "William/Mary/Glorius Revolution" then
                                                                                                        do shell script "say -v samantha Correct Answer"
                                                                                              else
                                                                                                        do shell script "say -v samantha Wrong Answer"
      #---------Question 10-----
                                                                                                        display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
                                                                                                        set A10 to (button returned of the result)
                                                                                                        if A10 is "Rights" then
                                                                                                                  do shell script "say -v samantha Correct Answer"
                                                                                                        else
                                                                                                                  do shell script "say -v samantha Wrong Answer"
      #---------Question 11------
                                                                                                                  display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
                                                                                                                  set A11 to (button returned of the result)
                                                                                                                  if A11 is "Ohio" then
                                                                                                                            do shell script "say -v samantha Correct Answer"
                                                                                                                  else
                                                                                                                            do shell script "say -v samantha Wrong Answer"
      #------Question 12---------
                                                                                                                            display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
                                                                                                                            set A12 to (button returned of the result)
                                                                                                                            if A12 is "George Washington" then
                                                                                                                                      do shell script "say -v samantha Correct Answer"
                                                                                                                            else
                                                                                                                                      do shell script "say -v samantha Wrong Answer"
      #---------Question 13-------
                                                                                                                                      display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
                                                                                                                                      set A13 to (button returned of the result)
                                                                                                                                      if A13 is "Ben Franklin" then
                                                                                                                                                do shell script "say -v samantha Correct Answer"
                                                                                                                                      else
                                                                                                                                                do shell script "say -v samantha Wrong Answer"
      #--------Question 14------
                                                                                                                                                display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
                                                                                                                                                set A14 to (button returned of the result)
                                                                                                                                                if A14 is "" then
                                                                                                                                                          do shell script "say -v samantha Correct Answer"
                                                                                                                                                else
                                                                                                                                                          do shell script "say -v samantha Wrong Answer"
      #-------Question 15-------
                                                                                                                                                          display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
                                                                                                                                                          set A15 to (button returned of the result)
                                                                                                                                                          if A15 is "Command an attack against French" then
                                                                                                                                                                    do shell script "say -v samantha Correct Answer"
                                                                                                                                                          else
                                                                                                                                                                    do shell script "say -v samantha Wrong Answer"
      #------TheLolQuestion-----
                                                                                                                                                                    display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
                                                                                                                                                                    set LOOL to (button returned of the result)
                                                                                                                                                                    if LOOL is "Mr.White" then
                                                                                                                                                                              do shell script "say -v samantha Congratulations…you…have…common…sense"
                                                                                                                                                                    else
                                                                                                                                                                              do shell script "say -v alex Do…you…have…eyes?"
                                                                                                                                                                              #------END------
                                                                                                                                                                              display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
                                                                                                                                                                              set endmenu to (button returned of the result)
                                                                                                                                                                              if endmenu is "I did!" then
                                                                                                                                                                                        do shell script "say -v samantha Your awesome"
                                                                                                                                                                              else
                                                                                                                                                                                        do shell script "say -v alex Go outside and run a lap"
                                                                                                                                                                              end if
                                                                                                                                                                    end if
                                                                                                                                                          end if
                                                                                                                                                end if
                                                                                                                                      end if
                                                                                                                            end if
                                                                                                                  end if
                                                                                                        end if
                                                                                              end if
                                                                                    end if
                                                                          end if
                                                                end if
                                                      end if
                                            end if
                                  end if
                        end if
              end if
    end if

    Use code such as:
    display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
    set A1 to (button returned of the result)
    if A1 is "Apprentices" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    #----------Question 2--------
    display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
    set A2 to (button returned of the result)
    if A2 is "Bible" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    (90444)

  • Please I really need help with this video problem.

    Hi!
    Please I need help with this app I am trying to make for an Android cellphone and I've been struggling with this for a couple of months.
    I have a main flash file (video player.fla) that will load external swf files. This is the main screen.When I click the Sets Anteriores button I want to open another swf file called sets.swf.The app is freezing when I click Sets Anteriores button
    Here is the code for this fla file.
    import flash.events.MouseEvent;
    preloaderBar.visible = false;
    var loader:Loader = new Loader();
    btHome.enabled = false;
    var filme : String = "";
    carregaFilme("home.swf");
    function carregaFilme(filme : String ) :void
      var reqMovie:URLRequest = new URLRequest(filme);
      loader.load(reqMovie);
      loader.contentLoaderInfo.addEventListener(Event.OPEN,comeco);
      loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progresso);
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completo);
      palco.addChild(loader); 
    function comeco(event:Event):void
              preloaderBar.visible = true;
              preloaderBar.barra.scaleX = 0;
    function progresso(e:ProgressEvent):void
              var perc:Number = e.bytesLoaded / e.bytesTotal;
              preloaderBar.percent.text = Math.ceil(perc*100).toString();
              preloaderBar.barra.scaleX =  perc;
    function completo(e:Event):void
              preloaderBar.percent.text = '';
              preloaderBar.visible = false;
    btHome.addEventListener(MouseEvent.MOUSE_DOWN,onHomeDown);
    btHome.addEventListener(MouseEvent.MOUSE_UP,onHomeUp);
    btSets.addEventListener(MouseEvent.MOUSE_DOWN,onSetsDown);
    btSets.addEventListener(MouseEvent.MOUSE_UP,onSetsUp);
    btVivo.addEventListener(MouseEvent.MOUSE_DOWN,onVivoDown);
    btVivo.addEventListener(MouseEvent.MOUSE_UP,onVivoUp);
    btHome.addEventListener(MouseEvent.CLICK,onHomeClick);
    btSets.addEventListener(MouseEvent.CLICK,onSetsClick);
    function onSetsClick(Event : MouseEvent) : void
              if (filme != "sets.swf")
                          filme = "sets.swf";
                          carregaFilme("sets.swf");
    function onHomeClick(Event : MouseEvent) : void
              if (filme != "home.swf")
                          filme = "home.swf";
                          carregaFilme("home.swf");
    function onHomeDown(Event : MouseEvent) : void
              btHome.y += 1;
    function onHomeUp(Event : MouseEvent) : void
              btHome.y -= 1;
    function onSetsDown(Event : MouseEvent) : void
              btSets.y += 1;
    function onSetsUp(Event : MouseEvent) : void
              btSets.y -= 1;
    function onVivoDown(Event : MouseEvent) : void
              btVivo.y += 1;
    function onVivoUp(Event : MouseEvent) : void
              btVivo.y -= 1;
    Now this is the sets.fla file:
    Here is the code for sets.fla
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    var video:Video;
    var nc:NetConnection;
    var ns:NetStream;
    var t : Timer = new Timer(1000,0);
    var meta:Object = new Object();
    this.addEventListener(Event.ADDED_TO_STAGE,init);
    function init(e:Event):void{
    video= new Video(320, 240);
    addChild(video);
    video.x = 80;
    video.y = 100;
    nc= new NetConnection();
    nc.connect(null);
    ns = new NetStream(nc);
    ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
    ns.bufferTime = 1;
    ns.client = meta;
    video.attachNetStream(ns);
    ns.play("http://www.djchambinho.com/videos/segundaquinta.flv");
    ns.pause();
    t.addEventListener(TimerEvent.TIMER,timeHandler);
    t.start();
    function onStatusEvent(stat:Object):void
              trace(stat.info.code);
    meta.onMetaData = function(meta:Object)
              trace(meta.duration);
    function timeHandler(event : TimerEvent) : void
      if (ns.bytesLoaded>0&&ns.bytesLoaded == ns.bytesTotal )
                ns.resume();
                t.removeEventListener(TimerEvent.TIMER,timeHandler);
                t.stop();
    The problem is when I test it on my computer it works but when I upload it to my phone it freezes when I click Sets Anteriores button.
    Please help me with this problem I dont know what else to do.
    thank you

    My first guess is you're simply generating an error. You'll always want to load this on your device in quick debugging over USB so you can see any errors you're generating.
    Outside that, if you plan on accessing anything inside the SWF you should be loading the SWF into the correct context. Relevant sample code:
    var context:LoaderContext = new LoaderContext();
    context.securityDomain = SecurityDomain.currentDomain;
    context.applicationDomain = ApplicationDomain.currentDomain;
    var urlReq:URLRequest = new URLRequest("http://www.[your_domain_here].com/library.swf");
    var ldr:Loader = new Loader();
    ldr.load(urlReq, context);
    More information:
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7de0.html
    If you're doing this on iOS you'll need to stripped SWFs if you plan on using any coding (ABC) inside the files. You mentioned iOS so I won't get into that here, but just incase, here's info on stripping external SWFs:
    http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air- apps-on-ios/

  • Still Need Help with this String Problem

    basically, i need to create a program where I input 5 words and then the program outputs the number of unique words and the words themselves. for example, if i input the word hello 5 times, then the output is 1 unique word and the word "hello". i have been agonizing over this dumb problem for days, i know how to do it using hashmap, but this is an introductory course and we cannot use more complex java functions, does ANYONE know how to do this just using arrays, strings, for loops, if clauses, etc. really basic java stuff. i want the code to be able to do what the following program does:
    import java.io.*; import java.util.ArrayList;
        public class MoreUnique {
           public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = new String[5]; int uniqueEntries = 0; ArrayList<String> ue = new ArrayList<String>();
             for (int i = 0; i < 5; i++) { System.out.print((i +1) + ": "); str[i] = br.readLine(); }
             for (int j = 0; j < 5; j++) {
                if (!ue.contains(str[j].toLowerCase())) { ue.add(str[j].toLowerCase()); } } uniqueEntries = ue.size(); System.out.print("Number of unique entries: " + uniqueEntries + " { ");
             for (int q = 0; q < ue.size(); q++ ) { System.out.print(ue.get(q) + " "); } System.out.println("}"); } } but i need to find how to do it so all 5 words are put in at once on one line, and without all the advanced java functions that are in here, can anyone help out?

    you have to compare string 0 to strings 1-4, then
    string 1 with strings 2-4, then string 2 with strings
    3 and 4 then string 3 with string 4....right???Here's a way to do it:
    public class MoreUnique {
        public static void main(String[] args) throws IOException {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            final int NUM_WORDS = 5;
            String[] words = new String[NUM_WORDS];
            int uniqueEntries = 0;
            for(int i = 0; i < NUM_WORDS; i++) {
                System.out.print((i+1)+": ");
                String temp = br.readLine();
                if(!contains(temp, words)) {
                    words[uniqueEntries++] = temp;
            System.out.print("Number of unique entries: "+uniqueEntries+" { ");   
            for (int i = 0; i < uniqueEntries; i++ ) {   
                System.out.print(words[i]+" ");
            System.out.println("}");
        private static boolean contains(String word, String[] array) {
                 Your code here: just a simple for-statement to
                 loop through your array and to see if 'word'
                 is in your 'array'.
    }Try to fill in the blanks.
    Good luck.

  • Need help with this book problem...Pig game...can ANYONE help!??

    I need help with the following book problem...could someone write this code for me?? Thanks!!
    First design and implement a class called PairOfDice, composed of two six-sided Die objects. Using the PairOfDice class, design and implement a class to play a game called Pig. In this game, the user competes against the computer. On each turn, the current player rolls a pair of dice and accumulates points. The goal is to reach 100 points before your opponent does. If, on any turn, the player rolls a 1, all points accumulated for that round are forfeited and control of the dice moves to the other player. If the player rolls two 1s in one turn, the player loses all points accumulated thus far in the game and loses control of the dice. The player may voluntarily turn over the dice after each roll. Therefore the player must decide to either roll again (be a pig) and risk losing points, or relinquish control of the dice, possibly allowing the other player to win. Implement the computer player such that it always relinquishes the dice after accumulating 20 or more points in any given round.
    I realize this is a long code, so it would be greatly appreciated to anyone who writes this one for me, or can at least give me any parts of it. I honestly have no clue how to do this because our professor is a dumbass and just expects us to know how to do this...he doesn't teach us this stuff...don't ask. Anyways, thanks for taking the time to read this and I hope someone helps out!! Thank you in advance to anyone who does!!!

    Nasty comments? It's not a matter of not liking you, it's a matter of responding to the
    "I'ts everyone else's fault but mine" attitude of your post.
    If you are genuine, the program is very easy to write, so, your Professor is correct when he said you should
    be able to do it. I'm still very much in the beginner category at java, and it took me only 20 mins to write
    (+5 mins to design it on paper). 2 classes in one file < 100 lines. Most of the regulars here would do it in half the time / half the lines.
    All of the clues are in the description, break them down into their various if / else conditions. Write it down on paper.
    Have a go. Try to achieve something. Post what you've tried, no-one will laugh at you, and you will be
    pleasanty surprised at the level of help you will get when you've "obviously" made some effort.
    Again, have a go. If you don't like problem-solving, then you don't like programming. So, you gotta ask
    yourself - "what am I doin' here?"

  • I need help whit this tricky problem:)

    Hi guys!
    I'm working with a webshop where i receive a tons of pictures from another company. Unfortunately they send me other pictures what i don't need. So i made a list from the files (like a list.txt) what i don't need and i want to write a script to move these files to another folder. How should i do this?
    Thx for your help!

    Prefi wrote:
    So i made a list from the files (like a list.txt) what i don't need and i want to write a script to move these files to another folder.
    So far I believe you have a bunch of photos (in a folder?) and you want to take specifically titled photos and move them to another folder?
    Alright so you have a folder that as an example contains:
    hello.jpeg
    welcome.jpeg
    goodbye.jpeg
    yes.jpeg
    no.jpeg
    Now you want to move welcome.jpeg and goodbye.jpeg to a new folder?
    Is this along the lines of what you want to do?

  • Need help in this sql query to use Case Statement

    hi All,
    I have the below query -
    SELECT DISTINCT OFFC.PROV_ID
    ,OFFC.WK_DAY
    ,CASE
    WHEN OFFC.WK_DAY ='MONDAY' THEN 1
    WHEN OFFC.WK_DAY ='TUESDAY' THEN 2
    WHEN OFFC.WK_DAY ='WEDNESDAY' THEN 3
    WHEN OFFC.WK_DAY ='THURSDAY' THEN 4
    WHEN OFFC.WK_DAY ='FRIDAY' THEN 5
    WHEN OFFC.WK_DAY ='SATURDAY' THEN 6
    WHEN OFFC.WK_DAY ='SUNDAY' THEN 7
    END AS DOW
    ,OFFC.OFFC_OPENG_TIME
    ,OFFC.OFFC_CLSNG_TIME
    FROM GGDD.PROV_OFFC_HR OFFC
    WHERE OFFC.PROV_ID='0000600'
    WITH UR;
    this query is bringing results in 6 differnt rows with opening and closing time for each day separately. I want to generate the data in one row with each day having opening and closing time, so for 7 days, total 14 columns with opening and closing time. But i am not able to do that using case statement.
    can somebody help me in achieving that.
    thanks,
    iamhere

    Hi,
    Welcome to the forum!
    That's called a Pivot .
    Instead of having 1CASE expression, have 14, one for the opening and one for the closing time each day, and do GROUP BY to combine them onto one row.
    SELECT       OFFC.PROV_ID
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_OPENG_TIME END)     AS mon_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_CLSNG_TIME END)     AS mon_cls
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_OPENG_TIME END)     AS tue_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_CLSNG_TIME END)     AS tue_cls
    FROM        GGDD.PROV_OFFC_HR OFFC
    WHERE       OFFC.PROV_ID     = '0000600'
    GROUP BY  offc.prov_id
    ;This assumes there is (at most) only one row in the table for each distinct prov_id and weekday. If not, what do you want to do? Post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    The staement above works in Oracle 8.1 and up, but there's a better way (SELECT ... PIVOT) available in Oracle 11. What version are you using? (It's always a good idea to include this when you post a question.)
    Edited by: Frank Kulash on Jan 6, 2011 8:22 PM

  • Need Help On this SQL

    Hello Good People,
    I have this query always running for ever .... I mean very long and casuing a lotta I/O (db file sequencial read):
    SELECT
         C.COLLECTOR,
         A.BUSINESS_UNIT,
         A.JOURNAL_ID,
         A.JOURNAL_DATE,
         A.UNPOST_SEQ,
         A.JOURNAL_LINE,
         A.LEDGER
    FROM
         PS_JRNL_LN A, PS_BI_ACCT_ENTRY B, PS_BI_HDR C
    WHERE
         A.JOURNAL_ID = :1
    AND A.JRNL_LINE_STATUS = '1'
    AND A.BUSINESS_UNIT = B.BUSINESS_UNIT
    AND A.JOURNAL_ID = B.JOURNAL_ID
    AND A.JOURNAL_DATE = B.JOURNAL_DATE
    AND A.JOURNAL_LINE = B.JOURNAL_LINE
    AND B.BUSINESS_UNIT = C.BUSINESS_UNIT
    AND B.INVOICE = C.INVOICE
    AND B.ACCOUNTING_DT = C.ACCOUNTING_DT
    Here are the details about the query:
    PS_JRNL_LN is a table with 11, 269, 729 rows
    PS_BI_ACCT_ENTRY is a table with 5, 293, 402 rows and,
    PS_BI_HDR is a table with 118, 191 rows
    It has PSFJRNL_LN (INDEX) and PS_BI_ACCT_ENTRY INDEX (UNIQUE)
    From the explain plan I ran from the SQL*Plus it has the following:
    Plan hash value: 3003908243
    | Id | Operation | Name | Cost (%CPU) | Time |
    | 0 | SELECT STATEMENT | 184K (3) | 00:36:49 |
    |* 1 | HASH JOIN | 184K (3)| 00:36:49 |
    |* 2 | TABLE ACCESS BY INDEX ROWID | PS_JRNL_LN | 1548 (1)| 00:00:19 |
    |* 3 | INDEX SKIP SCAN | PSFJRNL_LN | 1547 (1)| 00:00:19 |
    | 4 | NESTED LOOPS | 177K (1)| 00:35:36 |
    | 5 | TABLE ACCESS FULL | PS_BI_HDR | 2709 (2)| 00:00:33 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| PS_BI_ACCT_ENTRY | 2 (0)| 00:00:01 |
    |* 7 | INDEX RANGE SCAN | PS_BI_ACCT_ENTRY | 1 | | 1 (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------

    Actually I wanted to post only one but I mistakenly hit the post and stop it but it was gone already.
    But they are still different.
    This particular one is with SQL Profile that Ent. Mgr. recommends but i see it's costlier.
    And the other without SQL Profile.

  • Please need help on this SQL query ..

    hi peers,
    here is my situation :
    Field1 Field2 Field3
    xa group1 req_id1
    xb group2 req_id2
    xc group3 req_id3
    xa group4 req_id4
    xb group5 req_id5
    i need to pull only the group3 record that comes right away after group2. Req_id's are in chronological order and groupx are texts
    : i.e : req_id1 < req_id2 < req_id3 <.....
    in other terms, i need the record that comes after the re cord flagged by group2..knowing that req_id3 is right after req_id2.
    any thoughts ?
    thanks

    Hi,
    Use the analytic LAG function to get a value from an earlier row:
    WITH     got_prev_field2     AS
         SELECT     field1, field2, field3
         ,     LAG (field2) OVER (ORDER BY  field3)     AS prev_field2
         FROM     my_situation
    SELECT     field1, field2, field3
    FROM     got_prev_field2
    WHERE     prev_field2     = 'group2'
    ;Like all analytic functions, LAG is computed after the WHERE clause is applied. To use the value returned by LAG in a WHERE clause, we have to compute it in a sub-query.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.

  • Another Videora Post- I just need help with this one problem, please!

    I am guessing that the best way to convert your videos to an iPod compatible format is Videora. It works lovely, except for one glitch. I notice that the audio is noticeably off when I play the video. Any solution on how to fix this? I would really appreciate it if anyone helped me out on this
      Windows XP  

    It is on both, I am thinking.. I tried it with a movie avi file, and it always comes out off.

  • Need help with this sql query

    the following query returns me the correct no of rows:
    select col1 from tab1 where
    col1 like '%'||chr(32)||'%';
    but i need to use my query in the following form and it doesn't return any row:
    select col1 from tab1 where
    col1 IN ('%'||chr(32)||'%');
    what am I doing worng?
    thanks in advance.

    Or in 10g (just recycling another example):
    WITH t AS (SELECT 'OPTI1457' || CHR(32) col1
                 FROM dual
                UNION
               SELECT 'OPT123' || CHR(9)
                 FROM dual
                UNION
               SELECT 'OPTIM12345'
                 FROM dual
    SELECT t.*
      FROM t
    WHERE REGEXP_LIKE(t.col1, CHR(32) || '|' || CHR(9))
    ;       C.

  • Need Help with this SQL Report

    Declare @Total int
    Select
    @Total=count(*)
    From
    v_Add_Remove_Programs
    Where
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    Select Distinct
    v_Add_Remove_Programs.DisplayName0 as [Software Product],
    Version0 as [Version],
    COUNT(v_GS_System.Name0) as [Count],
    Round(100.0*count(*)/@Total,1) as [Percentage]
    FROM
    v_Add_Remove_Programs
    Join
    v_GS_System ON v_Add_Remove_Programs.ResourceID = v_GS_System.ResourceID
    WHERE
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    GROUP BY
    Version0,
    v_Add_Remove_Programs.DisplayName0
    ORDER BY
    [Percentage] DESC
    Select Distinct
    v_GS_SYSTEM.Name0 as [Computer Name],
    v_Add_Remove_Programs.DisplayName0 as [Software Product],
    Version0 as [Version]
    FROM
    v_Add_Remove_Programs
    Join
    v_GS_SYSTEM ON v_Add_Remove_Programs.ResourceID = v_GS_SYSTEM.ResourceID
    WHERE
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    GROUP BY
    v_GS_SYSTEM.Name0,
    Version0,
    v_Add_Remove_Programs.DisplayName0
    ORDER BY
    [Version] DESC
    If I remove the @DisplyaName variables and type in a product name sucha as:
    = 'Microsoft Office Professional 2013" or something, it works fine. How can I get the @DisplayName variables to work for me?
    Thanks

    v_Add_Remove_Programs.DisplayName0 Like '%'+ @DisplayName+'%'

  • FormsCentral retiring in July???!!!  Are you freaking kidding me?  My clients use this feature all the time.  What do you suggest I do now?  What service do I go with that is comparable to it?  I need help with this asap!

    FormsCentral retiring in July???!!!  Are you freaking kidding me?  My clients use this feature all the time.  What do you suggest I do now?  What service do I go with that is comparable to it?  I need help with this asap!

    I would suggest checking out http://www.logiforms.com. They have really good PDF support for both hosted PDF's and generating PDFs. You can:
    populate PDF forms from a web form submission
    Merge multiple PDF's together using conditional logic
    Include uploaded images in the generated PDF
    Get Electronic signatures on PDF's
    Use conditional logic when creating PDF's
    Convert HTML to PDF. You design in HTML and CSS and use form field wildcards and generate the PDF
    More of the PDF features are explained here:
    PDF Form Creator | PDF Form Maker | V3.Logiforms.com
    They are also offering a 25% discount to anyone coming from Forms Central...

  • Hi! I tried to instal whatsapp thro istore and it displayed the terms and conditions page. But the problem is there is no save or agree button. I am stuck in this page. I need help. This is a iphone5. This was after I upgraded to ios7

    Hi! I tried to instal whatsapp thro istore and it displayed the terms and conditions page. But the problem is there is no save or agree button. I am stuck in this page. I need help. This is a iphone5. This was after I upgraded to ios7.

    It is hardly Apple's fault that Epson can't/won't update their driver, but at least Epson suggest that you use the Gutenprint driver, which in any case is far better that what Epson offer.
    You can get it here:
    http://gimp-print.sourceforge.net/
    You can download the latest version from here:
    http://sourceforge.net/projects/gimp-print/
    Have you downloaded the recent Apple update to Epson drivers?
    http://support.apple.com/kb/DL1398

Maybe you are looking for

  • I need help in Report for production orders for my customer.

    Hi All I have scenario where plant A needs the following report for Material XXX which has setting as Stock Trnasfer order from Plant B. Need report withthe following details, Storage Unit number, Material No, Quantity, Planned Order Date in plant A,

  • Error 80043ac1 -  An external object raised an error. No Error Description

    Hello, After installing Crystal Reports runtime XI R2, I've been having the error: Crystal Reports ActiveX Designer error 80043ac1 -  An external object raised an error. No Error Description. This same runtime package have already been successfully i

  • Freezing Playback, Media Pending, No Saved Prvw Files -on Pr 6 Cloud.

    Freezing Playback, Media Pending, No Saved Prvw Files -on Pr 6 Cloud. My Creative Cloud Pr 6 is freezing video on the timeline and it's driving me crazy. Can't work all day. I've checked all my system settings and all seem to be okay. Running Creativ

  • Screen Sequence Group - VOV8

    Hi All, Where can we modify or create Screen Sequence Group for Sales document types. Thanks in advance.

  • Send smartform output by mail

    Hi, im tring to use the SO_DOCUMENT_SEND_API1 FM to send a smartform output by mail. Im able to convert the smartform output to pdf and save it to teh hard drive and works great but when i try to send the pdf doc by mail it comes corrupted... can any