Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HAVING Clause in SQL
Message
 
 
To
03/07/2003 09:32:15
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00806508
Message ID:
00806524
Views:
15
This message has been marked as a message which has helped to the initial question of the thread.
Renoir,

Yes, the HAVING clause is like a WHERE clause but for the intermediate record set (groups) created by GROUP BY. It's used when you want to apply conditions to the groups records. For example, find all duplicates in the table
SELECT keyfld, COUNT(*) AS DupCnt ;
  FROM mytable ;
  GROUP BY 1 ;
  HAVING DupCnt > 1
>Hey Sergey,
>
>How did I know it would be you to respond? <s>
>
>So, it almost like the SQL runs with the GROUP BY and then another WHERE is put on the results with the HAVING clause?
>
>What is the HAVING clause normally used for? To filter records after the SQL has processed?
>
>Renoir
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform