I have a table. userid, role, inheritance.
so for example userid Admin has 572 rows, but only 26 roles. Each role has 22 inheritances. I want a total by userid with a count of unique roles. so in this example 26 not 572
I tried this and received my count of 572
SELECT DISTINCTROW Left([userid],InStr([userid],'@')-1) AS UserName, tbldata20161122.userid, Count(tbldata20161122.Role) AS CountOfRole
FROM tbldata20161122
GROUP BY Left([userid],InStr([userid],'@')-1), tbldata20161122.userid;
I modified it to this using Dcount and I get an error message
SELECT DISTINCTROW Left([userid],InStr([userid],'@')-1) AS UserName, tbldata20161122.userid, DCount([tbldata20161122.Role],[tbldata20161122]) AS CountOfRole
FROM tbldata20161122
GROUP BY Left([userid],InStr([userid],'@')-1), tbldata20161122.userid;
error message
You tried to execute a query that does not include the specified expression DCount([tbldata20161122.Role],[tbldata20161122]) as part of an aggregate function
so for example userid Admin has 572 rows, but only 26 roles. Each role has 22 inheritances. I want a total by userid with a count of unique roles. so in this example 26 not 572
I tried this and received my count of 572
SELECT DISTINCTROW Left([userid],InStr([userid],'@')-1) AS UserName, tbldata20161122.userid, Count(tbldata20161122.Role) AS CountOfRole
FROM tbldata20161122
GROUP BY Left([userid],InStr([userid],'@')-1), tbldata20161122.userid;
I modified it to this using Dcount and I get an error message
SELECT DISTINCTROW Left([userid],InStr([userid],'@')-1) AS UserName, tbldata20161122.userid, DCount([tbldata20161122.Role],[tbldata20161122]) AS CountOfRole
FROM tbldata20161122
GROUP BY Left([userid],InStr([userid],'@')-1), tbldata20161122.userid;
error message
You tried to execute a query that does not include the specified expression DCount([tbldata20161122.Role],[tbldata20161122]) as part of an aggregate function