select - MySql how to count rows in 1 command -
hey got table workers , number of department work @ , need show amount of departments , there way in 1 select command? been trying use count , group manage show either total amount of workers or total amount of workers per department. p.s explain alittle better simple version , got table
name / department john 5 jerry 4 josh 4 erik 1
in case need somehting : amount_of_departments 3
if use count() amount_of_departments ... group department 1 2 1 or if use count() amount_of_departments .... 4 if possible lacking basic sql knowledge since starter : x
you looking count(distinct)
:
select count(distinct department) table t;
Comments
Post a Comment