Subqueries

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 some statistical information regarding the tickets sold: what are the movies where the tickets sold are greater than the average tickets sold for all the movies. To execute this query in SQL, we will use a query within a query, in other words, a subquery.

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 Subqueries button.


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