>>2,3
``
QUEL'' I guess.
Anyway, allow me to rephrase the problem with a better example.
Consider a table with some events, each of which has an associated date. Now, you want to answer the question "how many days have had more than 10 events?"
INSERT INTO temp_table SELECT COUNT() FROM events GROUP BY date;
This creates one row per day in
temp_table with the number of events for that given day.
SELECT COUNT() FROM temp_table WHERE i > 10;
And this counts how many of them are higher than 10. The "higher than 10" check can be folded into the first statement in the form of a
HAVING clause:
INSERT INTO temp_table SELECT COUNT() FROM events GROUP BY date HAVING COUNT() > 10;
But you must still count manually the number of rows in
temp_table:
SELECT COUNT() FROM temp_table;
Some SQL database engines have a non-standard directive to check now may rows are going to be affected by an statement, but I was looking for a more elegant solution.