Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006

    Unanswered: How to select fields along with the group function in oracle

    As we can do with mysql:-
    select <field>, count(*) from <table name> where <condition> and <some joins with other tables>
    Can we do same with oracle.

  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1
    select <field>, count(*) from <table name> where <condition> and <some joins with other tables>
    group by <field>;

  3. #3
    Join Date
    Jan 2006

    i think it will give a "not a group function" error

    it gave me an error while trying this query using grup by after using joins

    select cust.cust_id,cust.cust_name,rec.order_date,pay.inv oice_date from customers cust,
    recievers rec,payers pay where
    cust.cust_id=rec.cust_id and cust.cust_id=pay.cust_id
    and ((round(sysdate-rec.order_date)<365)or
    (round(sysdate-pay.invoice_date)<365)) group by

  4. #4
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 5
    It seems that you spread the same question through several threads here ... Well, you obviously didn't follow your own scenario, nor correct SQL syntax. In the last query provided, include ALL columns into the GROUP BY to avoid an error message. However, as you don't use any aggregate function in the SELECT statement, GROUP BY will probably give the same result as if you didn't use it at all.

    [EDIT] Sorry, I didn't notice that there were different posters in posts #1 and #3!
    Last edited by Littlefoot; 01-15-06 at 03:52.

Posting Permissions

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