0

When trying to count distinct values I have an error:

Every derived table must have its own alias

my query :

select count(*) as user from (select distinct user_type from userValidation);
forpas
  • 145,388
  • 9
  • 31
  • 69

1 Answers1

0

You should add an alias for the subquery:

select count(*) as user from (select distinct user_type from userValidation) t

but you can get the same results without the subquery:

select count(distinct user_type)  as user from userValidation
forpas
  • 145,388
  • 9
  • 31
  • 69