COUNT (MySQL): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(Nieuwe pagina aangemaakt met 'Bijvoorbeeld: <pre> select sum(order_total),count(*) from example.uc_orders </pre>') |
|||
Regel 5: | Regel 5: | ||
from example.uc_orders | from example.uc_orders | ||
</pre> | </pre> | ||
+ | |||
+ | Ander voorbeeld, inclusief <code>group by</code>: | ||
+ | |||
+ | <pre> | ||
+ | select | ||
+ | |||
+ | distinct brand, | ||
+ | count(brand) as brand_count | ||
+ | |||
+ | from device_tmp | ||
+ | group by brand | ||
+ | order by brand_count desc; | ||
+ | </pre> | ||
+ | |||
+ | == Zie ook == | ||
+ | |||
+ | * [[Grouping (MySQL)]] |
Versie van 27 nov 2019 17:23
Bijvoorbeeld:
select sum(order_total),count(*) from example.uc_orders
Ander voorbeeld, inclusief group by
:
select distinct brand, count(brand) as brand_count from device_tmp group by brand order by brand_count desc;