M
Martin
Hi,
I have this SQL which works almost as I want it to:
SELECT [tbl Staff].Name, [tbl Staff].Username, [tbl Staff].CST, (SELECT
Count(*) FROM [tbl Staff] AS X WHERE X.Name = X.Name AND [tbl Staff].Name >=
X.Name) AS Rank
FROM QryUsername RIGHT JOIN [tbl Staff] ON QryUsername.CST = [tbl Staff].CST
WHERE (((QryUsername.CST) Is Not Null))
GROUP BY [tbl Staff].Name, [tbl Staff].Username, [tbl Staff].CST
HAVING ((([tbl Staff].Username)<>GetUser()))
ORDER BY [tbl Staff].Name;
The rank is based on the table [tbl Staff] but I only want it to rank the
records that are selected in this query i.e. 14 records (or staff) instead of
the total 54 staff.
If I remove the rank comumn and write another query based on this one and
substitute the [tbl Rank] with the name of this query I get an error message
and Access closes.
Can anyone advise where I am going wrong?
Thanks in advance.
Martin
I have this SQL which works almost as I want it to:
SELECT [tbl Staff].Name, [tbl Staff].Username, [tbl Staff].CST, (SELECT
Count(*) FROM [tbl Staff] AS X WHERE X.Name = X.Name AND [tbl Staff].Name >=
X.Name) AS Rank
FROM QryUsername RIGHT JOIN [tbl Staff] ON QryUsername.CST = [tbl Staff].CST
WHERE (((QryUsername.CST) Is Not Null))
GROUP BY [tbl Staff].Name, [tbl Staff].Username, [tbl Staff].CST
HAVING ((([tbl Staff].Username)<>GetUser()))
ORDER BY [tbl Staff].Name;
The rank is based on the table [tbl Staff] but I only want it to rank the
records that are selected in this query i.e. 14 records (or staff) instead of
the total 54 staff.
If I remove the rank comumn and write another query based on this one and
substitute the [tbl Rank] with the name of this query I get an error message
and Access closes.
Can anyone advise where I am going wrong?
Thanks in advance.
Martin