Search the forum,

having

A HAVING clause in SQL specifies that an SQL SELECT statement must only return rows where aggregate values meet the specified conditions.
HAVING and WHERE are often confused by beginners, but they serve different purposes. WHERE is taken into account at an earlier stage of a query execution, filtering the rows read from the tables. If a query contains GROUP BY, rows from the tables are grouped and aggregated. After the aggregating operation, HAVING is applied, filtering out the rows that don't match the specified conditions. Therefore, WHERE applies to data read from tables, and HAVING should only apply to aggregated data, which isn't known in the initial stage of a query.
To view the present condition formed by the GROUP BY clause, the HAVING clause is used.

View More On Wikipedia.org
  • 121

    Dan

    Administrator From On the forum.
    • Messages
      2,780
    • Directory
      6
    • Reaction score
      1,222
    • Points
      113
  • 1

    Knappers

    Plumbers Arms member From Rugby
    • Messages
      997
    • Reaction score
      426
    • Points
      63
  • 1

    marvoni

    • Messages
      245
    • Reaction score
      110
    • Points
      43
  • 1

    mutley racers

    • Messages
      5,172
    • Reaction score
      812
    • Points
      113
  • 1

    bacon_sandwich

    • Messages
      254
    • Reaction score
      86
    • Points
      28
  • 1

    Ashley Brown

    • Messages
      3
    • Reaction score
      0
    • Points
      1
  • 1

    Steve weightman

    • Messages
      186
    • Reaction score
      78
    • Points
      28
  • 1

    Contadina

    • Messages
      6
    • Reaction score
      0
    • Points
      1
  • 1

    LJD1010

    From london
    • Messages
      42
    • Reaction score
      13
    • Points
      8
  • Creating content since 2001. Untold Media.

    Newest Plumbing Threads

    Back
    Top
    AdBlock Detected

    We get it, advertisements are annoying!

    Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

    I've Disabled AdBlock