Using the HAVING clause

4D - Documentation   Français   English   German   Japanese   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next

version 11


We would now like to get the total amount of tickets sold per year starting with 1979, but not including those with over 10,000,000 tickets sold. The result will be sorted by year.

To do this, we must total all the tickets sold for every movie in each year more recent than 1979, remove those where the total amount of tickets sold is greater than 10,000,000, and then sort the result by year.

The initial query in 4D code would be:

Using SQL code, the above query becomes:

Using generic SQL commands, the above query becomes:

Using the QUERY BY SQL command, the above query becomes:

Using the SQL EXECUTE IMMEDIATE command, the query above becomes:

To test all the above examples, launch the "4D SQL Code Samples" database and go to the main window. You can then choose the query mode and press the HAVING clause button.


4D - Documentation   Français   English   German   Japanese   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next