Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2006
    Posts
    5

    Red face Unanswered: SQL*PLUS question

    I'm using SQL*Plus to create a query. The query selects several numeric field then a text description, finally some dollar amounts that need to be summed. Ideally I want to group on the number fields, sum the dollar amounts and have one description. My problem is that there are several descriptions in the table for the same group of numeric fields. How do I elimate null and different text fields? At this point I don't care which description it picks, as long as it doesn't select any nulls.

    Thank you in advance for any suggestions.

    Cathy

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    please post your current query and also some sample output with duplicate descriptions.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    If you don't care what discription is used, then try something like

    select max(description),sum(amt),my_id
    from mytable
    group by my_id;
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  4. #4
    Join Date
    Sep 2006
    Posts
    5
    Quote Originally Posted by beilstwh
    If you don't care what discription is used, then try something like

    select max(description),sum(amt),my_id
    from mytable
    group by my_id;

    Thank you so much! This works perfectly!

  5. #5
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Your welcome and welcome to the Oracle forums. Feel free to ask any questions or answer any questions. You might occasionally get a few grumpy answers, but the people in this forum are very knowledgble and helpful.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •