MySQL aggregate anomaly
It looks like you are hitting this regression bug:


  select count(distinct N1), count(distinct N2) from test.AA" works incorrectly
  ...
  "This bug happens when a unique index exists"


One of the suggested workarounds is to use sql_buffer_result