Welcome Guest. Sign in or Signup

3 Answers

Aggregate functions and Group by Clause

Asked by: 4479 views SQL

You would have written some SQL statements for sure that has an aggregate function followed by some sort of group by clause. Is it always necessary for an aggregate function to have a group by clause?

Related Questions

3 Answers



  1. Ravi on Apr 05, 2013 Reply

    Yes. Group by should include all fields in select statement which are not part of non-aggregate functions.

    +3 Votes Thumb up 0 Votes Thumb down 0 Votes



  2. Candidate on Apr 05, 2013 Reply

    A group by is not always required.
    Say, Select count(*) from PSOPRDEFN;
    This statement doesn’t need a group by.

    However, as Ravi points out in the above answer, if you have some fields (other than the aggregate function) in the select clause, those fields should go into the group by as well.

    +10 Votes Thumb up 0 Votes Thumb down 0 Votes



  3. Sivasan on Apr 19, 2013 Reply

    SetSearchDialogBehavior(0);

    Use this code in Component Record SearchInit event

    -4 Votes Thumb up 0 Votes Thumb down 0 Votes


Answer Question