This has probably been asked before, but I'm unable to make my way through the myriad of search results.

What is the most optimized way to count the number of times each distinct value of column x was used?

e.g. Given a table containing

`mike mary mike`

Return results like:

`mike 2 mary 1`

Thanks in advance

If your calculation is in the same table (Materiel) that would then be this:

ExecuteSQL ( "

SELECT COUNT(*)

FROM \"Materiel\"

WHERE \"Model\" = ?

" ; "" ; "" ; Materiel::Model )

Make the calculation unstored