access sql inner join and count in 2 tables -
i have question sql queries in access (i started 3 days ago)
so there 2 tables: employes , departments, want create query show name , id of each employe , how many departments manages.
employee( id, name, social_security_of_employe) department(department_id, social_security_of_employee) (social security primary key) try was:
select e.id, e.name, count(d.social_security) number_of_departments employee e inner join department d d.social_security=e.social_security group social_security thanks in advance
the correct syntax ms access is:
select e.id, e.name, count(d.social_security) number_of_departments employee e inner join department d on d.social_security = e.social_security group e.id, e.name; changes:
- ms access requires
astable aliases. - the
whereclause shouldonclause. - the columns in
group byneed match unaggregated columns inselect.
Comments
Post a Comment