Help with some methods !! Please..

Hi !!
My University teacher gave me an exercize where he askes to calculate the minimum,medium and maximum cubic capacities in an ArrayList<Cars> carList .
I didn't find problems to make a new method for searching the minum and maximum cubic capacities,but I could not think a way to make the method for the Average cubic capacity value.
For the min and max searches I wrote down :
public Car searchForMinCubicCapacityValue()
Car car= carList.get(0);
for(Car aCar : carList)
if(aCar.getCubicCapacity() <= car.getCubicCapacity())
minimumCar = aCar; (where minimumCar is an Instance Variable)
return minimumCar;
The same is for the method searchForMaxCubicCapacityValue() but I put >= indeed and I have used the Instance Variable maximumCar.
How could I write down the method searchForAverageCubicCapacityValue() ?
I really need your help please !...
I have to know for next week test ! In this test I'll have to write down a class with these same methods and others !
Thanks in advance !

Sorry ! I'll change the name of my 3 methods !
I would calculate by hand an average just adding up
the cubic capacities and then dividing the result of
this addition by the total number of cars.Right.
But I have tried to write down this one in the method
for an Average cubic capacity but I get the same
result of the maximum cubic capacity.Well, then the Java you wrote doesn't do what you described above. If you show the code, someone can help you find your error.
When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. (http://forum.java.sun.com/help.jspa?sec=formatting) It makes it much easier to read.
But I know that
there is an average value in my ArrayList !Of course there is. Any collection of values has an average.
I think this thing happens because the result of the
division is a number that doesn't exist in my
ArrayList.The average may very well not be a numbre in the list. If the list contains only 0 and 100, the average is 50, which is not in the list.

Similar Messages

  • Help with some javascript, please

    I'm trying to do some calculations in a form with code like
    this -
    total1.value=(quantity1.value*hiddenPrice1.value) +
    hiddenSHUS1.value
    which is 'working' although not as I intended. If these are
    the values
    involved -
    quantity1 = 2
    hiddenPrice1 = 15.00
    hiddenSHUS1 = 4.00
    the value I get is - 304.00!
    I expected to get - 34.00
    It appears to be concatenating the two values as sort of
    strings, no?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================

    Thanks, guys. I think the parseFloat() is what I needed. I'll
    let you
    know....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Ken Ford - *ACE*" <[email protected]> wrote in
    message
    news:fl6ekq$qui$[email protected]..
    > It is treating them like strings.
    >
    > You need to use parseFloat()
    >
    > I think it would be something like this:
    >
    > total1.value = (parseFloat(quantity1.value) *
    > parseFloat(hiddenPrice1.value)) +
    parseFloat(hiddenSHUS1.value)
    >
    > --
    > Ken Ford
    > Adobe Community Expert - Dreamweaver
    > Fordwebs, LLC
    >
    http://www.fordwebs.com
    >
    >
    > "Murray *ACE*" <[email protected]>
    wrote in message
    > news:fl6d2k$pfb$[email protected]..
    >> I'm trying to do some calculations in a form with
    code like this -
    >>
    >> total1.value=(quantity1.value*hiddenPrice1.value) +
    hiddenSHUS1.value
    >>
    >> which is 'working' although not as I intended. If
    these are the values
    >> involved -
    >>
    >> quantity1 = 2
    >> hiddenPrice1 = 15.00
    >> hiddenSHUS1 = 4.00
    >>
    >> the value I get is - 304.00!
    >>
    >> I expected to get - 34.00
    >>
    >> It appears to be concatenating the two values as
    sort of strings, no?
    >>
    >> --
    >> Murray --- ICQ 71997575
    >> Adobe Community Expert
    >> (If you *MUST* email me, don't LAUGH when you do
    so!)
    >> ==================
    >>
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >>
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >> ==================
    >>
    >>
    >

  • Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Upgrade to 11.2.0.3 -- Interoperability Notes Oracle EBS R12 with Oracle Database 11gR2 (11.2.0.3) (Doc ID 1585578.1)
    Upgrade to 11.2.0.4 (latest 11gR2 patchset certified with R12) -- Interoperability Notes EBS 12.0 and 12.1 with Database 11gR2 (Doc ID 1058763.1)
    Thanks,
    Hussein

  • Help with some beginner code

    Hello, I am new to java and I need a bit of help with some code that I'm writing. here is the code:
    import javax.swing.*;
    public class Test{
         public static void main(String[] args){
         JOptionPane.showMessageDialog(null,"We will now build a block with *'s","Block",1);
         String input=JOptionPane.showInputDialog(null,"Type a number: ","Number",3);
         int number=Integer.parseInt(input);
         int count=0; int count2=0;
         for(count2=0; count2<number; count2++){
              for(count=0; count<number; count++){
              System.out.print("* ");
    System.exit(0);
    }Now, all I need is to build a block of *'s with the number that the user inputs. With the code that I wrote I get the correct number of *'s but not in the form of a block. They just print out in a straight line. I know this is a very simple task but could someone please help me out? What do I need to modify in my code so that the *'s print out arranged as a block like so:
    **********

    Your code only uses the print method which prints without a carriage return/line feed. So you need to add a line of code to print a carriage return/line feed. Where? well that is your task to work out.

  • Help with access control please

    So I'm trying to set up my brother's PSP to the wirless network through MAC address timed access. What I want to do is make it so that he can only access it through certain times in the day. I'm having troubles with actually getting it to work. Everytime I set it up, the PSP only show's up as a DHCP client and not a Wireless client. I tried the option panel with the add wireless clients through the first try access. Could I get some help with this issue please? Thanks!

    Just to calm your fears... There is no conspiracy. If someone had an answer or a suggestion they would post it.

  • Need help with Sound Methods

    Hi, I am new to java and need help with sound methods.
    q: create a new method that will halve the volume of the positive values and double the volume of the negative values.
    Message was edited by:
    Apaula30

    duplicate message #2

  • I would need help with the following please: I need to save some of my email on a disk. I was going to Print, then Save PDF but then I am stuck. Help please. Thanks. Elisabeth

    I would need help with saving some eamil messages to a disk to unclutter my email. How can I do this please?
    Thanks.
    Elisabeth

    Open the email and then from the File menu select Save As Rich Text Format. That'll save it to open in TextEdit. If you want a pdf then open the email and do command-p (Print) and then from the PDF drop down box lower left corner select Save as PDF.

  • Pbroblems with Synchronized methods --- please help

    ** One Thread calls a synchronized method using an object (obj1) of a Class (Class name - meth_class) and occupies the monitor of that particular object (obj1). Then no other Thread can call that particular synchronized method or any other synchronized method of the object (obj1) of a Class (Class name - meth_class). **
              IF THE ABOVE DEFINITION IS TRUE PLEASE HELP ME OUT WITH THE FOLLOWING:
    Please go through the code below:-
    class meth_class
              volatile boolean valueset=false;
              int var;
              synchronized int get()
                        if (!valueset)
                                  try
                                            wait();
                                  catch (InterruptedException e)
                                            System.out.println("Consumer interrupted");
                        System.out.println("Get - " + var);
                        valueset=false;
                        notify();
                        return var;
              synchronized void put(int x)
                        if (valueset)
                                  try
                                            wait();
                                  catch (InterruptedException e)
                                            System.out.println("Producer interrupted");
                        this.var=x;
                        System.out.println("Put - " + var);
                        valueset=true;
                        notify();
    class producer implements Runnable
              meth_class obj;
              Thread thrd;
              producer(meth_class x)
                        obj=x;
                        thrd=new Thread(this, "Producer");
                        thrd.start();
              public void run()
                        int var=0;
                        while(true)
                                  obj.put(var++);
    class consumer implements Runnable
              meth_class obj;
              Thread thrd;
              consumer(meth_class x)
                        obj=x;
                        thrd=new Thread(this, "Consumer");
                        thrd.start();
              public void run()
                        while(true)
                                  obj.get();
    class main_thrd
              public static void main(String args[])
                        meth_class obj=new meth_class();
                        new producer(obj);
                        new consumer(obj);
                        System.out.println("Press Control-C to stop");
    My Questions are:
    1.     class main_thrd creates two objects as ?new producer(obj)? and ?new consumer(obj)?. Now both these objects creates 2 threads and try to call two different Synchronized methods of same CLASS ? ?meth_class? through a single object by the name of ?obj? created in class main_thrd. Now as ?new producer(obj)? object is created first in the class main_thrd, the Thread created by it enters the monitor of object (obj) and locks it. Then as per the rule the Thread created by ?new consumer(obj)? object never gets to occupy the monitor of the object (obj) because Producer is in an infinite loop. BUT THEN WHY WE HAVE ? GET - ** ? VALUES PRINTED IN THE OUTPUT.
    Please any one help me out,
    (THANKS FOR ALL YOUR HELP)

    Now as ?new producer(obj)? object is called first in the class main_thrd, the Thread created by it enters the monitor of object (obj) and locks it.Though new producer(obj) is called first, it is not necessary that the thread created by it gets the lock of object(obj) first. This is false
    assumption.
    Next, even if we assumed that it gets the lock of given object first,
    while(true)
        obj.put(var++);
    }The lock of Object(obj) is released when the obj.put(var++) returns and any one can get hold of lock of the Object(obj) at that instant.
    In fact, next time obj.put(var++) is called, it will have to wait until it can get lock of the given object.

  • Help with some iPhone issues please

    Ok, I am starting to have some problems with my iPhone 3G, and would really appreciate any help with these issues.. here is what is happening
    1) iPhone Vibrate is pretty much broken, turns off and on vibrate by itself.. and now is vibrating very softly.
    2) iPhone wont sync my Music anymore, I have 3 playlists that I use on my iPhone, and none of them will update. When I sync my iPhone, everything syncs but the music.
    3) iPhone sometimes completely freezes and i cant get it to go to the locksreen or power off, so I have to do a hard restart.

    Hi Matt,
    Try restoring the iPhone, this article: http://support.apple.com/kb/HT1414 will walk you through the process.
    If the vibrate and unlock issues persists, the iPhone may need hardware repair. Just make a reservation to have a Genius, at a local Apple retail store, take a look at it or call AppleCare.
    http://www.apple.com/retail/geniusbar/
    U.S. iPhone technical support: 1-800-MY-IPHONE (1-800-694-7466)
    Message was edited by: Jason L

  • Please help with some problems with my N96

    Hi there,
    I have spent a fair bit of money on my Nokia N96 and unfortunately it is out of its warranty etc.And I have few issues with it.
    So can anyone advise me as to how about I can overcome some issues:
    Firstly, in my message inbox only the numbers display instead of the names (e.g.. +447770260.. Instead of Peter), has anyone had this issue or can help with this? I have gone into the message setting and nothing sticks out and says click me for number or name to be displayed.
    Secondly, the vibrating device doesn't seem to work at all some days and other days it seems fine? Is this a common fault or is it my phone. Also, is there anywhere on the phone to adjust the vibrating force which maybe getting in the way?
    Many thanks for any advise or for merely looking, and grateful for any help.
    Adam  

    /discussions/board/message?board.id=smartphones&message.id=112590&query.id=115949#M112590
    read the above thread in regards to the contacts issue. it is a common issue for the s60 phones no fix as yet and it has been few years now.
    there is no way you can adjust the vibration force. its either on or off. the vibration should work at all times if you have it set to work. it should not be random. you might want to take it to nokia care for them to have a look at it despite the fact that it is out of warranty.  
    You know what I love about you the most, the fact that you are not me ! In love with technology and all that it can offer. Join me in discovery....

  • Help with If statement please

    Hi,
    First Special thanks to Kglad for the help with the AS1 to AS3 conversion.
    I've been able to link up my buttons to play a different frames of the movie. this was my novice way of finally getting the programming to work.
    In frame 95 I have
    var myLoader:Loader = new Loader();
    addChild(myLoader); var url:URLRequest = new URLRequest("page1.swf");
    myLoader.load(url);
    in frame 165:
    var myLoader1:Loader = new Loader();
    addChild(myLoader1); var url1:URLRequest = new URLRequest("page1.swf");
    myLoader1.load(url1);
    My buttons link to 116 which plays a frame and loads ^
    in frame 226: removeChild(myLoader).
    But if the user has looped back into home from another part in the movie clip then it would need to remove myLoader1 instead of myLoader.
    I'm guessing there is some really dynamic way to solve the programatic nightmare i'm developing, but I'm really novice.
    So what i need is an if statement for frame 226
    That would do something:
    if(myLoader <> null
         removeChild(myLoader)
    else(
    removechild(myLoader1)
    Anyone have a method for this?

    yes, you can use the same urlrequest but just change its url property:
    // initialize, for example in frame 1.  this is done once and never again:
    var loader:Loader=new Loader();
    var urlR:URLRequest=new URLRequest();
    //  then in frame 2, for example:
    urlR.url="page1.swf";
    loader.load(urlR);
    //  in frame 20, for example:
    urlR.url="page2.swf";
    loader.load(urlR);
    // in frame 30, for example:
    urlR.url="page3.swf";
    loader.load(urlR);
    //etc.  if you're loading any swfs that play streams (sound or video), you'll want to add some code to this.

  • Help with some java work ... :(

    Hi, I was wondering can anyone here give me some help or show me the way with this programming assignment. This is my first week of programming in Java and is really struggling ...
    I already have some very useful help from some people on here but still have no luck.
    Below is what my assignment is about and what I've done so far, sorry if it's very basic but I'm trying my hardest.
    You are required to write a program in Java that can store the details of three books. Their details are
    Author
    Shelf location
    Availability
    The program should give each book a unique shelf location starting from 0001. The details should be entered from the keyboard. The program should, on request, be able to print the details of each book to the screen. The program should terminate on request. The program should first ask for a preset password to be given before continuing executing any operation described above
    public class Library {
    public static void main(String[] args) {
    String[][] books =
         { "Shelf Location", "Author   ", "Book Name     ", "Availability" },
    { "0001          ", "A. Smith ", "Hello World   ", "1           " },
    { "0002          ", "C. Jones ", "Goodbye World ", "0           " },
    { "0003          ", "D. Wan   ", "Whatever      ", "5           " }
    for (int i = 0; i < books.length; i++) {
         System.out.print(books[0] + " ");
    for (int j = 1; j < books[i].length; j++) {
         System.out.print(books[i][j] + " ");
         System.out.println();
    import java.io.*;
    public class Login2
    private static BufferedReader in;
    private static BufferedReader keyboard;
    public static void main(String[] args) throws IOException
    keyboard = new BufferedReader(
    new InputStreamReader(System.in));
    String input;
    boolean done = false;
    while (!done)
    System.out.print("Enter Password in UPPERCASE (QUIT to exit)");
    input = keyboard.readLine();
    if ((input.equals("LOGIN")) || (input.equalsIgnoreCase("QUIT")))
    done =
    true;
    return.Library();
    I was told to use cases, instances, etc ... nothing complicated is needed but it is still to much for me. I saw some examples of people's work and they only have approx 1.5 pages of code.
    Thanx very much for people who reads this thread and offers me help.

    Here's something to play around with (minimal error handling)
    import java.io.*;
    class Library
      private final String password = "java";
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      private String books[][] = new String[3000][];
      int bookTotal = 0;
      public Library() throws IOException
        options();
      private void options() throws IOException
        System.out.print("\nLibrary Options - \n0 - quit\n1 - Enter book details"+
              "\n2 - List book details\n\nPlease enter selection number: ");
        int selection = Integer.parseInt(br.readLine());
        if(selection == 0) goodBye();
        else
          checkPassword();
          if(selection == 1) newBook();
          else listBook();
      private void newBook() throws IOException
        String another="";
        do
          if(bookTotal == books.length)
            System.out.println("Unable to add more books");
            return;
          books[bookTotal] = new String[4];
          System.out.print("\nEnter title details: ");
          books[bookTotal][0] = br.readLine();
          System.out.print("Enter author details: ");
          books[bookTotal][1] = br.readLine();
          System.out.print("Enter shelf location details: ");
          books[bookTotal][2] = br.readLine();
          System.out.print("\n0 - out of stock\n1 - available\n2 - on loan"+
                                           "\nEnter availability details: ");
          books[bookTotal][3] = br.readLine();
          bookTotal++;
          System.out.print("\nEnter another book? (y/n): ");
          another = br.readLine();
        }while(another.toLowerCase().equals("y"));
        options();
      private void listBook() throws IOException
        String another="";
        String titles = "\n";
        String availability[] = {"out of stock","available","on loan"};
        for(int i=0;i<bookTotal;i++) titles += (i+1)+" - "+books[0]+"\n";
    int selection = 0;
    if(bookTotal > 0)
    do
    System.out.print(titles+ "Please enter selection number: ");
    selection = Integer.parseInt(br.readLine()) - 1;
    System.out.println("\nBook title = "+books[selection][0]);
    System.out.println("Book author = "+books[selection][1]);
    System.out.println("Book shelf location = "+books[selection][2]);
    System.out.println("Availability = "+availability[Integer.parseInt(books[selection][3])]);
    System.out.print("\nList another book? (y/n): ");
    another = br.readLine();
    }while(another.toLowerCase().equals("y"));
    else System.out.println("\nno books to list\n");
    options();
    private void goodBye()
    System.out.println("\nThank you for using the Library program.\nGoodbye.\n");
    System.exit(0);
    private void checkPassword() throws IOException
    System.out.print("\nEnter password to continue: ");
    String pwd = br.readLine();
    if(!pwd.equals(password)) goodBye();
    public static void main(String args[]) throws IOException
    new Library();

  • Help with photo albums Please

    Hi, i really need some help with my pictures, I've only got a very basic understanding of how my phone works and have somehow put a load of albums on my phone when i plugged it into the computer-I want to delete some of them off the phone but cannot work out how to do it, when i plug my phone in i can find the photo tab but cannot actually see the pictures and can't see any delete button!!! Please can someone help me, basic explanations would be gratefully recieved xxxx

    The photo sync is one way: computer to phone. To remove photos, synced to your phone, remove the check marks next to the albums/folders under the photos tab in itunes & hit the apply/sync button. They will be removed from your phone. You cannot delete photos that were synced to your phone, directly on your phone. The easiest way to manage photos synced to your phone is to create albums or folders on your computer. Move whatever photos you want on your phone into these albums/folders & then select them under the photos tab in itunes to sync to your phone. You can then remove or add photos to these various albums/folders on your computer & the itunes sync process will update your phone every time you sync.

  • [8i] Need help with some workday calculations

    At the beginning of the month, I got help with a workday calculation in: [8i] Help with function with parameters (for workday calculation)
    Now, as it turns out, I was able to locate a function in the database that does what I want, however, it is much slower to use the function than to join two copies of the CALN table (Please see referenced thread for details. I can copy them to this thread if necessary.) I need to verify that the pre-existing function has 'DETERMINISTIC' in it, as I would guess that if it doesn't, it would be much slower than it could be.
    But now, I've come across a situation where I have to do multiple workday calculations in the same query--enough that I have to join 6 copies of my CALN table. I can't imagine that is at all efficient. I believe it was Frank K. who said (in the original thread) that if the function was slow, I should consider alternatives. Can anyone help me identify some of those alternatives? I'm definitely at that point now. (This query is one I'm using as the base for a report in Oracle BI, and let's just say it doesn't like my query, even though my syntax appears to be correct, and I would guess that joining 6 copies of one table is at least partly to blame for this).
    Note: I'm working with Oracle 8i

    OK, I finally have some sample data... I tried to make it thorough. I've included data in the CALN table YTD + tomorrow, so that any workday calculations using SYSDATE will work.
    CREATE TABLE caln
    (     clndr_dt     DATE          NOT NULL
    ,     clndr_yr     NUMBER
    ,     shop_day     NUMBER
    ,     shop_dt          DATE
    ,     shop_wk          NUMBER
    ,     shop_yr          NUMBER
    ,     shop_days     NUMBER
    ,     clndr_days     NUMBER
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    INSERT INTO     caln
    VALUES (To_Date('12/23/2009','mm/dd/yyyy'),2009,247,To_Date('12/23/2009','mm/dd/yyyy'),51,2009,7631,10950);
    INSERT INTO     caln
    VALUES (To_Date('01/01/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10959);
    INSERT INTO     caln
    VALUES (To_Date('01/02/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10960);
    INSERT INTO     caln
    VALUES (To_Date('01/03/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),1,2010,7631,10961);
    INSERT INTO     caln
    VALUES (To_Date('01/04/2010','mm/dd/yyyy'),2010,1,To_Date('01/04/2010','mm/dd/yyyy'),1,2010,7632,10962);
    INSERT INTO     caln
    VALUES (To_Date('01/05/2010','mm/dd/yyyy'),2010,2,To_Date('01/05/2010','mm/dd/yyyy'),1,2010,7633,10963);
    INSERT INTO     caln
    VALUES (To_Date('01/06/2010','mm/dd/yyyy'),2010,3,To_Date('01/06/2010','mm/dd/yyyy'),1,2010,7634,10964);
    INSERT INTO     caln
    VALUES (To_Date('01/07/2010','mm/dd/yyyy'),2010,4,To_Date('01/07/2010','mm/dd/yyyy'),1,2010,7635,10965);
    INSERT INTO     caln
    VALUES (To_Date('01/08/2010','mm/dd/yyyy'),2010,5,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10966);
    INSERT INTO     caln
    VALUES (To_Date('01/09/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10967);
    INSERT INTO     caln
    VALUES (To_Date('01/10/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),2,2010,7636,10968);
    INSERT INTO     caln
    VALUES (To_Date('01/11/2010','mm/dd/yyyy'),2010,6,To_Date('01/11/2010','mm/dd/yyyy'),2,2010,7637,10969);
    INSERT INTO     caln
    VALUES (To_Date('01/12/2010','mm/dd/yyyy'),2010,7,To_Date('01/12/2010','mm/dd/yyyy'),2,2010,7638,10970);
    INSERT INTO     caln
    VALUES (To_Date('01/13/2010','mm/dd/yyyy'),2010,8,To_Date('01/13/2010','mm/dd/yyyy'),2,2010,7639,10971);
    INSERT INTO     caln
    VALUES (To_Date('01/14/2010','mm/dd/yyyy'),2010,9,To_Date('01/14/2010','mm/dd/yyyy'),2,2010,7640,10972);
    INSERT INTO     caln
    VALUES (To_Date('01/15/2010','mm/dd/yyyy'),2010,10,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10973);
    INSERT INTO     caln
    VALUES (To_Date('01/16/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10974);
    INSERT INTO     caln
    VALUES (To_Date('01/17/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),3,2010,7641,10975);
    INSERT INTO     caln
    VALUES (To_Date('01/18/2010','mm/dd/yyyy'),2010,11,To_Date('01/18/2010','mm/dd/yyyy'),3,2010,7642,10976);
    INSERT INTO     caln
    VALUES (To_Date('01/19/2010','mm/dd/yyyy'),2010,12,To_Date('01/19/2010','mm/dd/yyyy'),3,2010,7643,10977);
    INSERT INTO     caln
    VALUES (To_Date('01/20/2010','mm/dd/yyyy'),2010,13,To_Date('01/20/2010','mm/dd/yyyy'),3,2010,7644,10978);
    INSERT INTO     caln
    VALUES (To_Date('01/21/2010','mm/dd/yyyy'),2010,14,To_Date('01/21/2010','mm/dd/yyyy'),3,2010,7645,10979);
    INSERT INTO     caln
    VALUES (To_Date('01/22/2010','mm/dd/yyyy'),2010,15,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10980);
    INSERT INTO     caln
    VALUES (To_Date('01/23/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10981);
    INSERT INTO     caln
    VALUES (To_Date('01/24/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),4,2010,7646,10982);
    INSERT INTO     caln
    VALUES (To_Date('01/25/2010','mm/dd/yyyy'),2010,16,To_Date('01/25/2010','mm/dd/yyyy'),4,2010,7647,10983);
    INSERT INTO     caln
    VALUES (To_Date('01/26/2010','mm/dd/yyyy'),2010,17,To_Date('01/26/2010','mm/dd/yyyy'),4,2010,7648,10984);
    INSERT INTO     caln
    VALUES (To_Date('01/27/2010','mm/dd/yyyy'),2010,18,To_Date('01/27/2010','mm/dd/yyyy'),4,2010,7649,10985);
    INSERT INTO     caln
    VALUES (To_Date('01/28/2010','mm/dd/yyyy'),2010,19,To_Date('01/28/2010','mm/dd/yyyy'),4,2010,7650,10986);
    INSERT INTO     caln
    VALUES (To_Date('01/29/2010','mm/dd/yyyy'),2010,20,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10987);
    INSERT INTO     caln
    VALUES (To_Date('01/30/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10988);
    INSERT INTO     caln
    VALUES (To_Date('01/31/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),5,2010,7651,10989);
    INSERT INTO     caln
    VALUES (To_Date('02/01/2010','mm/dd/yyyy'),2010,21,To_Date('02/01/2010','mm/dd/yyyy'),5,2010,7652,10990);
    INSERT INTO     caln
    VALUES (To_Date('02/02/2010','mm/dd/yyyy'),2010,22,To_Date('02/02/2010','mm/dd/yyyy'),5,2010,7653,10991);
    INSERT INTO     caln
    VALUES (To_Date('02/03/2010','mm/dd/yyyy'),2010,23,To_Date('02/03/2010','mm/dd/yyyy'),5,2010,7654,10992);
    INSERT INTO     caln
    VALUES (To_Date('02/04/2010','mm/dd/yyyy'),2010,24,To_Date('02/04/2010','mm/dd/yyyy'),5,2010,7655,10993);
    INSERT INTO     caln
    VALUES (To_Date('02/05/2010','mm/dd/yyyy'),2010,25,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10994);
    INSERT INTO     caln
    VALUES (To_Date('02/06/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10995);
    INSERT INTO     caln
    VALUES (To_Date('02/07/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),6,2010,7656,10996);
    INSERT INTO     caln
    VALUES (To_Date('02/08/2010','mm/dd/yyyy'),2010,26,To_Date('02/08/2010','mm/dd/yyyy'),6,2010,7657,10997);
    INSERT INTO     caln
    VALUES (To_Date('02/09/2010','mm/dd/yyyy'),2010,27,To_Date('02/09/2010','mm/dd/yyyy'),6,2010,7658,10998);
    INSERT INTO     caln
    VALUES (To_Date('02/10/2010','mm/dd/yyyy'),2010,28,To_Date('02/10/2010','mm/dd/yyyy'),6,2010,7659,10999);
    INSERT INTO     caln
    VALUES (To_Date('02/11/2010','mm/dd/yyyy'),2010,29,To_Date('02/11/2010','mm/dd/yyyy'),6,2010,7660,11000);
    INSERT INTO     caln
    VALUES (To_Date('02/12/2010','mm/dd/yyyy'),2010,30,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11001);
    INSERT INTO     caln
    VALUES (To_Date('02/13/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11002);
    INSERT INTO     caln
    VALUES (To_Date('02/14/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),7,2010,7661,11003);
    INSERT INTO     caln
    VALUES (To_Date('02/15/2010','mm/dd/yyyy'),2010,31,To_Date('02/15/2010','mm/dd/yyyy'),7,2010,7662,11004);
    INSERT INTO     caln
    VALUES (To_Date('02/16/2010','mm/dd/yyyy'),2010,32,To_Date('02/16/2010','mm/dd/yyyy'),7,2010,7663,11005);
    INSERT INTO     caln
    VALUES (To_Date('02/17/2010','mm/dd/yyyy'),2010,33,To_Date('02/17/2010','mm/dd/yyyy'),7,2010,7664,11006);
    INSERT INTO     caln
    VALUES (To_Date('02/18/2010','mm/dd/yyyy'),2010,34,To_Date('02/18/2010','mm/dd/yyyy'),7,2010,7665,11007);
    INSERT INTO     caln
    VALUES (To_Date('02/19/2010','mm/dd/yyyy'),2010,35,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11008);
    INSERT INTO     caln
    VALUES (To_Date('02/20/2010','mm/dd/yyyy'),2010,0,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11009);
    CREATE TABLE ords
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     ord_stat     VARCHAR2(2)
    ,     ord_qty          NUMBER
    ,     part_nbr     VARCHAR2(5)
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr)
    INSERT INTO     ords
    VALUES (1,1,'CL',10,'PART1');
    INSERT INTO     ords
    VALUES (1,2,'CL',5,'PART1');
    INSERT INTO     ords
    VALUES (25,1,'CL',15,'PART2');
    INSERT INTO     ords
    VALUES (14,1,'OP',12,'PART3');
    INSERT INTO     ords
    VALUES (33,1,'CL',25,'PART1');
    INSERT INTO     ords
    VALUES (33,2,'CL',15,'PART1');
    INSERT INTO     ords
    VALUES (33,3,'OP',10,'PART1');
    INSERT INTO     ords
    VALUES (7,1,'PL',18,'PART2');
    INSERT INTO     ords
    VALUES (96,1,'PL',10,'PART3');
    INSERT INTO     ords
    VALUES (31,1,'CL',20,'PART2');
    CREATE TABLE oops
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     op_nbr          VARCHAR2(4)     NOT NULL
    ,     mach_id          VARCHAR2(4)
    ,     oper_stat     VARCHAR2(2)
    ,     plan_start_dt     DATE
    ,     plsu          NUMBER
    ,     plrn          NUMBER
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr, op_nbr)
    -- NOTE:
    -- for the orders with a status of 'CL' or 'PL' in the 'ords' table, I'm not bothering to put
    -- in more than two operations (though in reality more would be there) since they should be
    -- ignored in the final result anyway
    INSERT INTO     oops
    VALUES (1,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (1,2,'0010','123A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (25,1,'0005','123A','CP',TO_DATE('01/18/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (25,1,'0030','110C','CL',TO_DATE('01/19/2010','mm/dd/yyyy'),4,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0010','127A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0025','110C','CL',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0040','050C','CP',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.15);
    INSERT INTO     oops
    VALUES (14,1,'0050','220B','WK',TO_DATE('01/14/2010','mm/dd/yyyy'),4,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0065','242B','AV',TO_DATE('01/18/2010','mm/dd/yyyy'),1.5,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0067','150G','NA',TO_DATE('01/19/2010','mm/dd/yyyy'),2,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0100','250G','NA',TO_DATE('01/20/2010','mm/dd/yyyy'),2.1,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,2,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,3,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0020','220B','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1.7,0.15);
    INSERT INTO     oops
    VALUES (33,3,'0030','150G','NA',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.05);
    INSERT INTO     oops
    VALUES (33,3,'0055','150G','NA',TO_DATE('01/15/2010','mm/dd/yyyy'),2.1.,0.1);
    INSERT INTO     oops
    VALUES (7,1,'0005','123A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (7,1,'0030','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (96,1,'0010','127A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (96,1,'0025','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (31,1,'0005','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (31,1,'0030','110C','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    CREATE TABLE mach
    (     mach_id          VARCHAR2(4)     NOT NULL
    ,     desc_short     VARCHAR2(9)     
    ,     group          VARCHAR2(7)
         CONSTRAINT ords_pk PRIMARY KEY (mach_id)
    INSERT INTO     mach
    VALUES     ('123A','desc here','GROUPH1');
    INSERT INTO     mach
    VALUES     ('259B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('110C','desc here','GROUPJ1');
    INSERT INTO     mach
    VALUES     ('050C','desc here','GROUPK2');
    INSERT INTO     mach
    VALUES     ('220B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('150G','desc here','GROUPL1');
    INSERT INTO     mach
    VALUES     ('250G','desc here','GROUPL2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');

  • Help with SQL statements please.... URGENT PLEASE!!!!

    I have 2 Tables
    TABLE_NAME COLUMN_NAME DATA_TYPE
    TASTEWINE TWDATE DATE
    TASTEWINE BIN NUMBER
    TASTEWINE QUANTITY NUMBER
    TASTING TDATE DATE
    TASTING PLACE VARCHAR2
    a) Table TASTING has 2 columns.... TDATE( date Tasting was Held) and PLACE ( locations at which Tasting was held)
    b) Table TASTEWINE has 3 Columns.............. TWDATE( wine tasting date, BIN( ID number for type of wine that was tasted), AND QUANTITY( quantity of win consumed by bottles)
    Here is the QUestion.... I am having a hard time figuring out how to connect those two tables based on this information .. What I want to do is this.....select the total number of bottles of wine served at each wine-tasting, but only for the second half of the year 1999, and I want to see not only the date and total bottles served, but also the location where the wine-tasting took place. I also want to display the date, the place, and total quantity.
    Can Anyone please Help me??

    Hi,
    Your query works fine - as well as the one mentioned by Alok. I have tired it with some sample values, and both show the same results:-
    The two tables :-
    CREATE TABLE TASTEWINE
         TWDATE     DATE,
         BIN     NUMBER,
         QUANTITY NUMBER
    CREATE TABLE TASTING
         TDATE DATE,
         PLACE VARCHAR2(100)
    );Rows in the Tables:-
    INSERT INTO TASTEWINE VALUES (TO_DATE('01/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('02/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('03/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('04/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('05/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('06/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('07/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('08/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('09/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('10/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('11/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('12/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('01/12/2000','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('02/12/2000','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('03/12/2000','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('04/12/2000','MM/DD/YYYY'),1,100);
    COMMIT;
    INSERT INTO TASTING VALUES (TO_DATE('01/12/1999','MM/DD/YYYY'),'SEATTLE');
    INSERT INTO TASTING VALUES (TO_DATE('02/12/1999','MM/DD/YYYY'),'SAN FRANSICO');
    INSERT INTO TASTING VALUES (TO_DATE('03/12/1999','MM/DD/YYYY'),'DENVER');
    INSERT INTO TASTING VALUES (TO_DATE('04/12/1999','MM/DD/YYYY'),'AUSTIN');
    INSERT INTO TASTING VALUES (TO_DATE('05/12/1999','MM/DD/YYYY'),'SALT LAKE CITY');
    INSERT INTO TASTING VALUES (TO_DATE('06/12/1999','MM/DD/YYYY'),'LOS ANGLES');
    INSERT INTO TASTING VALUES (TO_DATE('07/12/1999','MM/DD/YYYY'),'PORTLAND');
    INSERT INTO TASTING VALUES (TO_DATE('08/12/1999','MM/DD/YYYY'),'NEW YORK');
    INSERT INTO TASTING VALUES (TO_DATE('09/12/1999','MM/DD/YYYY'),'NEWARK');
    INSERT INTO TASTING VALUES (TO_DATE('10/12/1999','MM/DD/YYYY'),'EL PASO');
    INSERT INTO TASTING VALUES (TO_DATE('11/12/1999','MM/DD/YYYY'),'AUSTIN');
    INSERT INTO TASTING VALUES (TO_DATE('12/12/1999','MM/DD/YYYY'),'CHICAGO');
    INSERT INTO TASTING VALUES (TO_DATE('01/12/2000','MM/DD/YYYY'),'ATLANTA');
    INSERT INTO TASTING VALUES (TO_DATE('02/12/2000','MM/DD/YYYY'),'HOLLYWOOD');
    INSERT INTO TASTING VALUES (TO_DATE('03/12/2000','MM/DD/YYYY'),'');
    INSERT INTO TASTING VALUES (TO_DATE('04/12/2000','MM/DD/YYYY'),'SEATTLE');
    COMMIT;The First Query :-
    SELECT
         A.TWDATE,
         B.PLACE,
         SUM(A.QUANTITY)
    FROM
         TASTEWINE     A,
         TASTING          B
    WHERE
              A.TWDATE = B.TDATE
         AND     B.TDATE > TO_DATE('01/07/1999', 'DD/MM/YYYY')
         AND     B.TDATE < TO_DATE('01/01/2000', 'DD/MM/YYYY')
    GROUP BY
         A.TWDATE,
         B.PLACE;The Second Query :-
    SELECT
         A.TWDATE,
         B.PLACE,
         SUM(A.QUANTITY)
    FROM
         TASTEWINE     A,
         TASTING          B
    WHERE
              A.TWDATE = B.TDATE
         AND     B.TDATE
                   BETWEEN
                        TO_DATE('01/07/1999', 'DD/MM/YYYY')      AND
                        TO_DATE('01/01/2000', 'DD/MM/YYYY')
    GROUP BY
         A.TWDATE,
         B.PLACE;Regards,
    Sandeep

Maybe you are looking for

  • Commenting and Digitally Sign

    Dear Adobe Acrobat Team, I am adding an annotation and a digital signature to a pdf document through my being-developed application, however when open that pdf with adobe acrobat, it validates the signature, and reports that "Annotations Modified" un

  • Upgraded To Leopard, lost files & user settings?

    Trying to update from Panther to Leopard on 1.25 Ghz iMac, used the Archive & Install. It looked like a successful install until the very end, whereupon the warning "Installation Failed due to problem migrating user data, try again." Perhaps foolishl

  • QuickTIme pro movies to DVD

    Hi there So i have downloaded a file, which is .avi format. i can run it in QT no problem, but the wife wants to watch it on telly ( lost for anyone that is nosey ) and i was wondering what is the best way and quickest way to burn it onto a DVD. so o

  • What is the serial number that I need to install this new photoshop product I just bought?

    I need help. I purchased a new Adobe photoshop elements 11 from Best Buy and I have all the boxes. I try and install this using the numbers on the back of the inner liner but it keeps saying invalid serial number go back and try again. What am I doin

  • Where do I download the Chinese language pack for Snow Leopard?

    I need to be able to write simplified Chinese.