Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2013
    Posts
    5

    Unanswered: Sorting problem in view

    I have problem sorting the results of this view:

    Code:
    CREATE OR REPLACE VIEW open_items_summary AS
    SELECT vendor_name, COUNT(*) AS open_item_count, SUM(invoice_total - payment_total - credit_total) AS open_item_total
    FROM Vendors v JOIN Invoices i ON v.vendor_id = i.vendor_id
    WHERE invoice_total - payment_total - credit_total > 0
    ORDER BY open_item_total DESC;
    I am getting this erro: not a single-group group function.
    And when I do GROUP BY open_item_total I get this error: "OPEN_ITEM_TOTAL": invalid identifier

    Does anyone know how to start that?
    I am very new to oracle btw.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Code:
    CREATE OR REPLACE VIEW open_items_summary AS
    SELECT vendor_name, 
           Count(*)                                          AS open_item_count, 
           SUM(invoice_total - payment_total - credit_total) AS open_item_total 
    FROM   vendors v 
           join invoices i 
             ON v.vendor_id = i.vendor_id 
    WHERE  invoice_total - payment_total - credit_total > 0 
    GROUP BY  vendor_name
    ORDER  BY open_item_total DESC;
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Oct 2013
    Posts
    5
    Quote Originally Posted by anacedent View Post
    Code:
    CREATE OR REPLACE VIEW open_items_summary AS
    SELECT vendor_name, 
           Count(*)                                          AS open_item_count, 
           SUM(invoice_total - payment_total - credit_total) AS open_item_total 
    FROM   vendors v 
           join invoices i 
             ON v.vendor_id = i.vendor_id 
    WHERE  invoice_total - payment_total - credit_total > 0 
    GROUP BY  vendor_name
    ORDER  BY open_item_total DESC;
    It worked!!! Thank you

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >It worked!!!
    That is why I posted it.
    ;-)
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Woohoo! What does that mean?!? Anacedent posted a smiley!!! A true historical moment!

Tags for this Thread

Posting Permissions

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