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
as
table aliases. - the
where
clause shouldon
clause. - the columns in
group by
need match unaggregated columns inselect
.
Comments
Post a Comment